Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting the datetime to a time in the future
Message
 
To
23/05/2006 06:05:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01124202
Message ID:
01124210
Views:
16
>>>I have a datetime field named scheduled. I would like to replace the contents of the field with the next time the clock is 9 a.m in the morning. So if the datetime were say 23/05/2006 10:36:42
>>>I would like to replace the value with 24/05/2006 09:00:00.
>>>
>>>Can anybody help me please?
>>>
>>>Thanks
>>
>>NewDateTime = DateTimeField + (24*60*60)
>>? DATETIME(YEAR(NewDateTime), MONTH(NewDateTime), DAY(NewDateTime),9,0,0)
>>
>>** or
>>NewDateTime = TTOD(DateTimeField) + 1
>>? DATETIME(YEAR(NewDateTime), MONTH(NewDateTime), DAY(NewDateTime),9,0,0)
>>
>
>I was thinking in the same lines, but then an easier solution "hit me in the head". :-)
>?Datetime() -Seconds() + (33*60*60) && 33=24+9
Yes, this is great, but If the DateTime value is stored in a field then you couldn't get SECONDS() so easily :-)
Imagine that the field contains:
01/01/2006 12:33:55, then your method will works only if it is executed at 12:33:55 ;-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform