Somebody2


I seem to be able to get the time from datetime() by taking time(datetime()), but this will return a result like 11:57:37.50. How can I get this to return just 11:57


Re: Time from DateTime

Naomi Nosonovsky


Check Help on TIME() function. It doesn't require a second parameter, but it would always return 8 chars string. If you don't need seconds, you can just strip them

lcTime = left(time(),5)






Re: Time from DateTime

dni

Code Snippet
STR(HOUR(DATETIME()),2,0)+":"+STR(MINUTE(DATETIME()),2,0)







Re: Time from DateTime

Somebody2

This does work the way I want, but I messed up. The datetime is actually a previous datetime stored in a variable. For example, 07/07/2007 12:41:32 AM, and now it is 07/11/2007 12:47:52 PM. When I use left(time(timein),5) it seems to display the time right now, which is 12:47, not 12:41.

timein is the stored variable with the datetime. In this example timein would be equal to 07/07/2007 12:41:32 AM.





Re: Time from DateTime

Naomi Nosonovsky

Then go with dni's solution. You can also use

lcTime = ttoc(tTime)

=MESSAGEBOX(SUBSTR(m.lcTime,AT(" ", m.lcTime) + 1))

I have SET SECONDS OFF.