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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formatted as text

Status
Not open for further replies.

benderulz

IS-IT--Management
Nov 2, 2010
43
US
Is there a way to format Now()-1 as text used in a query criteria?

example 2011-10-26 07:30:00 would show as 20111026073000
 
Now()-1 is a day ago.

So if now() is:
10/26/2011 2:11:40 PM

and now()-1 is:
10/25/2011 2:11:40 PM

then I would think now()-1 as a big text string is:
SELECT year(now()-1)&month(now()-1)&day(now()-1)&hour(now()-1)&minute(now()-1)&second(now()-1)

or:
20111025141140

 
Although why you would want to do that and make a date harder to work with I don't know.
 


Code:
format(Now()-1,"yyyymmddhhnnss")


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
@BigRed1212 Unfortunately, I'm working with someone else's database that formatted their dates that way. Caused me nothing but problems.

Thanks everyone for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top