Date/time question

  • Thread starter Thread starter DGR
  • Start date Start date
D

DGR

I have a time value in the number of seconds since 1970. I need to convert
this into a date/time format such as MM/DD/YYYY HH:MM or something similar.
This value needs to display in terms of the local time/time zone on which my
program is running.

Are there any built-in functions that do this conversion that take time zone
into account? I'm not sure where to find any VB.NET time-related functions.

Thanks for any help you can provide.
 
(e-mail address removed) (DGR) scripsit:
I have a time value in the number of seconds since 1970. I need to convert
this into a date/time format such as MM/DD/YYYY HH:MM or something similar.
This value needs to display in terms of the local time/time zone on which my
program is running.

Are there any built-in functions that do this conversion that take time zone
into account? I'm not sure where to find any VB.NET time-related functions.

Have a look at the 'DateTime' and 'TimeSpan' classes.
 
DGR said:
I have a time value in the number of seconds since 1970. I need to
convert this into a date/time format such as MM/DD/YYYY HH:MM or
something similar. This value needs to display in terms of the local
time/time zone on which my program is running.

Are there any built-in functions that do this conversion that take
time zone into account? I'm not sure where to find any VB.NET
time-related functions.

Thanks for any help you can provide.

dim d as date
d = #1/1/1970#.AddSeconds(NoOfSeconds)

Is the value the local zone or UTC? If it is UTC:

d = d.tolocaltime
 
Back
Top