Oct 26, 2011 #1 benderulz IS-IT--Management Joined Nov 2, 2010 Messages 43 Location 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
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
Oct 26, 2011 #2 BigRed1212 Technical User Joined Mar 11, 2008 Messages 550 Location US 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 Upvote 0 Downvote
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
Oct 26, 2011 #3 BigRed1212 Technical User Joined Mar 11, 2008 Messages 550 Location US Although why you would want to do that and make a date harder to work with I don't know. Upvote 0 Downvote
Oct 26, 2011 #4 S SkipVought Programmer Joined Dec 4, 2001 Messages 47,492 Location US Code: format(Now()-1,"yyyymmddhhnnss") Skip, Just traded in my old subtlety... for a NUANCE! Upvote 0 Downvote
Oct 26, 2011 #5 Gammachaser Programmer Joined Apr 30, 2011 Messages 183 Location US A little easier: Code: Select Format(Now()-1,"yyyymmddhhmmss") ... Upvote 0 Downvote
Oct 26, 2011 #6 BigRed1212 Technical User Joined Mar 11, 2008 Messages 550 Location US Never done it that way. Good to know. Upvote 0 Downvote
Oct 26, 2011 #7 Gammachaser Programmer Joined Apr 30, 2011 Messages 183 Location US Dangit Skip, you did it again... beat me by seconds! Upvote 0 Downvote
Oct 26, 2011 #8 Gammachaser Programmer Joined Apr 30, 2011 Messages 183 Location US ...and I had a typo. "...hhmmss" should be "...hhnnss" as Skip shows. Upvote 0 Downvote
Oct 26, 2011 Thread starter #9 benderulz IS-IT--Management Joined Nov 2, 2010 Messages 43 Location US @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! Upvote 0 Downvote
@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!
Oct 27, 2011 #10 S SkipVought Programmer Joined Dec 4, 2001 Messages 47,492 Location US Next to useless! Skip, Just traded in my old subtlety... for a NUANCE! Upvote 0 Downvote