Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS
From: Paul E. Black (p.black_at_acm.org)
Date: 11/14/03
- Next message: Paul E. Black: "Re: sets and vectors"
- Previous message: Ben Pfaff: "Re: Symbol table speed"
- In reply to: Olathe: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Next in thread: Corey Murtagh: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Reply: Corey Murtagh: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Nov 2003 12:45:34 -0500
Olathe <Olathe@DALnet.irc> writes:
> >>Gustavo Rios writes:
> >>
> >>>... convert a given number of seconds_in_year since
> >>>01/01/1970 UTC to a given format: YYYY-MM-DD : HH-MM-SS.
Julian date routines do this quite well. A "Julian date" is the
number of seconds since a point in the far past (4,000 something
B.C.). So date calculations are just converting dates to "Julian
dates" (seconds), adding or subtracting seconds, then converting back
to YYYY-MM-DD.
For instance if you have the number of seconds since 01/01/1970 and
you want the year, month, and day, do something like this
epoch = yyyymmddToJulian(01/01/1970);
currentDate = JulianToyyyymmdd(epoch + numberOfSeconds);
where currentDate has the year, month, and day broken out. Remaining
seconds can be converted to hours, minutes, and seconds in a straight-
forward way.
I have some well-tested Julian date routines in C that I'd be happy to
send you.
-paul-
-- Paul E. Black p.black@acm.org
- Next message: Paul E. Black: "Re: sets and vectors"
- Previous message: Ben Pfaff: "Re: Symbol table speed"
- In reply to: Olathe: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Next in thread: Corey Murtagh: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Reply: Corey Murtagh: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|