public class Time_t_To_DateTime {
public static void Main() {
int t= 1070390676; // value of time_t
System.DateTime dt= new System.DateTime(1970,1,1).AddSeconds(t);
System.Console.WriteLine(dt);
}
}
ps: no need to cross post
"Mattias Sjögren" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mark,
>
> >I am being supplied a count of number of seconds since Jan 1st 1970, i.e.
a
> >Unix system time. How can I convert this into a valid .Net DateTime
object ?
>
> Get a DateTime value representing Jan 1st 1970, then call AddSeconds
> on it.
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.