Save in DB as seconds since 1970

  • Thread starter Thread starter Sheldon
  • Start date Start date
S

Sheldon

Hello -

I have two datetimepickers, depicting login and logout times. I retrieved
the information which is stored in the database as the number of seconds
since 1970 and formatted it in Sql Server as:
Select dateadd(ss, MIN(Login), '1970') as Login,
dateadd(ss, MAX(Logout), '1970') as Logout
FROM etc.

I stored the values in two textboxes and set the datetimepickers to the
value in the textboxes and then formatted them in the datetimepickers as
HH:mm:ss so the user sees, for example, 09:30:00 indicating they had started
work at 9:30.

Now I need to allow the user to change that value and save it back to the
database. How do I do that? Is there a way of converting it in visual basic
2008 or converting it in Sql Server in an insert statement?

Any clues are appreciated!
 
Sheldon said:
Hello -

I have two datetimepickers, depicting login and logout times. I retrieved
the information which is stored in the database as the number of seconds
since 1970 and formatted it in Sql Server as:
Select dateadd(ss, MIN(Login), '1970') as Login,
dateadd(ss, MAX(Logout), '1970') as Logout
FROM etc.

I stored the values in two textboxes and set the datetimepickers to the
value in the textboxes and then formatted them in the datetimepickers as
HH:mm:ss so the user sees, for example, 09:30:00 indicating they had started
work at 9:30.

Now I need to allow the user to change that value and save it back to the
database. How do I do that? Is there a way of converting it in visual basic
2008 or converting it in Sql Server in an insert statement?

Any clues are appreciated!


--
You're using Unix style epoch time? Here's the VB.NET routines to convert
between epoch time and VB date
http://windevblog.blogspot.com/2008/09/epoch-time-in-vbnet.html


Teme64 @ http://windevblog.blogspot.com
 
Back
Top