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:
01086355
Views:
37
Again not tested much
? DATETIME(YEAR(ltDt), MONTH(ltDt), DAY(ltDt), HOUR(ltDt), 0, 0) + ;
	CEILING((MINUTE(ltDT)*60 + SEC(ltDT))/(15*60)) * 15*60
>>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?
>>>
> I also didn't specify the problem correctly. I always want to schedule for the future.
>
>I believe your code does what I want after I'd make minor adjustments.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform