Oct 26, 2011 #1 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
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 Mar 11, 2008 550 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 Mar 11, 2008 550 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 Dec 4, 2001 47,492 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 Apr 30, 2011 183 US A little easier: Code: Select Format(Now()-1,"yyyymmddhhmmss") ... Upvote 0 Downvote
Oct 26, 2011 #6 BigRed1212 Technical User Mar 11, 2008 550 US Never done it that way. Good to know. Upvote 0 Downvote
Oct 26, 2011 #7 Gammachaser Programmer Apr 30, 2011 183 US Dangit Skip, you did it again... beat me by seconds! Upvote 0 Downvote
Oct 26, 2011 #8 Gammachaser Programmer Apr 30, 2011 183 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 Nov 2, 2010 43 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 Dec 4, 2001 47,492 US Next to useless! Skip, Just traded in my old subtlety... for a NUANCE! Upvote 0 Downvote