Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Input Question

Status
Not open for further replies.

vzachin

Technical User
Feb 10, 2006
305
US
Hi,

I have a query from the mainframe to input a from & to date in the following format: YYYYMMDD.
The top of the screen shows the current date 10/17/2006.
The default field (15,43,8) value is 20061001, where the first 4 characters equals the current year, characters 5 & 6 equals the current month, 7 & 8 characters equals 01.
Generally, I would need to change the 7 & 8 to yesterday's date. If it was the beginning of the month, then I would also change the 5 & 6 character to match the previous month.

The from & to dates will always be equal. And I will only run this query daily on Tuesday thru Friday only.

I have no problem grabbing the current dates. But how can I grab the previous date & month (if needed)?

thanks for your thoughts on this
zach
 



Hi,

Its almost ALWAYS easier to work with REAL DATES than with STRING representations of dates.
[/code]
sYYYYMMDD as string
'yesterday's date string
sYYYYMMDD = Format(Date-1, "yyyymmdd")
[/code]

Skip,

[glasses] [red][/red]
[tongue]
 
hi Skip,

thanks for the coding. that was too easy. i should've read Help first.


thanks again
zach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top