nanog mailing list archives
Re: Unix Timestamp
From: "Steven M. Bellovin" <smb () research att com>
Date: Mon, 22 Oct 2001 14:57:14 -0400
In message <5.1.0.14.2.20011022123839.05490760 () calamity wyoming com>, Brandon H andeland 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.
How accurate does your conversion need to be? Do you need timezones? Daylight time? On any Unix system, including the open-source clones, grab a copy of ctime.c; its job is to do exactly that. If you want to approximate the answer -- well, there are 86400 seconds/day, and either 365 or 366 days/year. The remaind when dividing by 86400 is the number of seconds into the current day, in UTC. --Steve Bellovin, http://www.research.att.com/~smb Full text of "Firewalls" book now at http://www.wilyhacker.com
Current thread:
- Re: Unix Timestamp, (continued)
- Re: Unix Timestamp Chrisy Luke (Oct 22)
- Re: Unix Timestamp Chris Adams (Oct 22)
- Re: Unix Timestamp Greg A. Woods (Oct 22)
- Re: Unix Timestamp Michael L. Barrow (Oct 22)
- Re: Unix Timestamp Henry Yen (Oct 22)
- Re: Unix Timestamp Owen DeLong (Oct 23)
- Re: Unix Timestamp Nathan Stratton (Oct 22)
- Re: Unix Timestamp Robert E. Seastrom (Oct 22)
- Re: Unix Timestamp Michael L. Barrow (Oct 22)
- Re: Unix Timestamp Mike Wiacek (Oct 22)