Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting seconds to a datetime

Status
Not open for further replies.

krpurcel

IS-IT--Management
Dec 1, 2003
77
US
I have a login and a logout field where the data is listed in seconds:
LOGIN: 1,257,328,840
LOGOUT: 1,257,340,039.

I need to convert these to DATETIME formats so we can check schedule adherence. I have tried DateTime({login]) an DateTimeValue({login}). Both generate an error message of "Dates must be between year 1 and year 9999".

Am I using the wrong function? Do I need to manipulate the seconds total in some way?

If this is already addressed in a previous post I apologize. I did search before posting, but the posts I reviewed were about converting seconds to days/hours/min/sec. I need to convert to a DateTime.

Thanks!
 
It looks like these might be based on seconds since 1/1/1970, so you could use:

dateadd("s",{table.login},datetime(1970,1,1,0,0,0))

Repeat for logout. You should verify though that this is the right logic.

-LB
 
Awesome LB. Thank you. I will try it out and verify the data.
 
LB,

As usual, your solution is simple and works perfectly. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top