Unix Timestamp

Does anyone have a formula to convert a unix time stamp into the current time?

I know it is January 1st, 1970, in UTC format. Just need some example code.

I'm trying to export some data from a HP/UX box into a MSSQL database and need to use the timestamp feature of MSSQL.

Thanks

Brandon Handeland <Brandon@wyoming.com> writes:

Does anyone have a formula to convert a unix time stamp into the
current time? I know it is January 1st, 1970, in UTC format. Just
need some example code.

I'm trying to export some data from a HP/UX box into a MSSQL database and
need to use the timestamp feature of MSSQL.

The best code I've seen for this (and which knows about most variants
of the timestamp seen in the wild) was written by Steve Bellovin et
al, and can be found in the inn distribution in lib/parsedate.y

                                        ---Rob

> Does anyone have a formula to convert a unix time stamp into the
> current time? I know it is January 1st, 1970, in UTC format. Just
> need some example code.
>
> I'm trying to export some data from a HP/UX box into a MSSQL database

and

> need to use the timestamp feature of MSSQL.

Since you're using MySQL, you may want to look at the FROM_UNIXTIME()
function. It's buit-in and you can use it to do the conversion as part of
your INSERT statements.

If you are using perl, localtime()

If you are using C, strftime() uses a timezone
struct provided by the c function localtime().
strftime takes printf style arguments, and builds
strings that represent the time for you.

mike