seconds to date

S

shoba

hi

i'm provided with time in seconds. this is the time elapsed from the
midnight to jan 1970 till certain date. i would like to know how to
determine that date using this time

thanks in advance
 
K

Karl Heinz Buchegger

shoba said:
hi

i'm provided with time in seconds. this is the time elapsed from the
midnight to jan 1970 till certain date. i would like to know how to
determine that date using this time

a minute has 60 seconds
there are 60 seconds per hour
24 hours make a day
....
 
P

Peter Gregory

Karl said:
a minute has 60 seconds
there are 60 seconds per hour
24 hours make a day
...

but its more complicated with leap-years and century breaks from leap-years.
Search for an algorithm on google, I'm sure you'll find one!

Pete
 
K

Karl Heinz Buchegger

Peter said:
but its more complicated with leap-years and century breaks from leap-years.

Ok. So what? It's still based on simple arithmetic. Depending
on the way the OP solves it exactly, additionaly there *could*
be involved:
arrays (for storing a table containing the number of days per month)
some if's (for determining if there is a leap year)
some loops
arithmetic no more complex then addition, subtraction, multiplication,
division, %

And the whole assignment is a good exercise in comming up with an algorithm.
 
K

Karl Heinz Buchegger

osmium said:
One bottom line is that cesium is more reliable than the planetary system.

One just needs to accept that in the planetary system the bodies influence
each other :)

Seriously: If someone thinks that leap seconds are strange, he/she should
look up how many and what time systems astronomers use. For them having
a clock which keeps in perfect sync with the earth rotation is an important
thing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,127
Messages
2,570,757
Members
47,315
Latest member
robertsoker

Latest Threads

Top