Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy way to convert datetime() to the nearest hour?
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01086260
Message ID:
01086374
Views:
30
Yes.

>I think code takes care about midnigh already.
>
>>That's similar to the idea I had in mind. But don't forget about midnigt. Also the requirement changed and I want the nearest 15 minutes rather than an hour.
>>
>>>Not tested
ltDt = DATETIME()
>>>? DATETIME(YEAR(ltDt), MONTH(ltDt), DAY(ltDt), HOUR(ltDt), 0, 0) + ;
>>>	IIF(MINUTE(ltDT)*60 + SEC(ltDT) >= 30*60, 1*60*60, 0)
>>>
>>>>
>>>>How can I convert datetime() to the nearest hour?
>>>>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform