473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

seconds to date

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
Jul 19 '05 #1
9 6720


shoba wrote:

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
....

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 19 '05 #2
Karl Heinz Buchegger wrote:


shoba wrote:

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
...


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
Jul 19 '05 #3

"Peter Gregory" <pe***********@durham.ac.uk> wrote in message news:bf**********@sirius.dur.ac.uk...
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!

Don't forget the leap seconds.
Jul 19 '05 #4
Ron Natalie writes:
Don't forget the leap seconds.


For most purposes that I can think of, I think leap seconds should be
ignored. They are external to our legal system etc. If a bank deposit
was made in the second preceding a leap second, a withdrawal was recorded as
happening either at the same second or the following (civil) second. The
leap second is treated as though it didn't exist except for a few nerds in
Boulder and their time-keeping buddies around the world.
Jul 19 '05 #5

"osmium" <r1********@comcast.net> wrote in message news:bf************@ID-179017.news.uni-berlin.de...
Ron Natalie writes:
Don't forget the leap seconds.


For most purposes that I can think of, I think leap seconds should be
ignored. They are external to our legal system etc. If a bank deposit
was made in the second preceding a leap second, a withdrawal was recorded as
happening either at the same second or the following (civil) second. The
leap second is treated as though it didn't exist except for a few nerds in
Boulder and their time-keeping buddies around the world.


If you're going to compute time intervals of years down to the second, you want
to do the leap seconds. If you don't care about them, you probably
ought not be using that much precision. Most banks don't do any accounting
in units smaller than a day.
Jul 19 '05 #6
osmium wrote:
Ron Natalie writes:
Don't forget the leap seconds.

I thought that was a joke at first, later I found leap seconds exist; wow,
I've been missing something special!
For most purposes that I can think of, I think leap seconds should be
ignored.
"Since the first leap second in 1972, all leap seconds have been positive
and there were 22 leap seconds in the 27 years to January, 1999. This
pattern reflects the general slowing trend of the Earth due to tidal
braking."
http://tycho.usno.navy.mil/leapsec.html

You wouldn't want the time to be 22 seconds out though (since it's time
since 1970 we're measuring)
The leap second is treated as though it didn't exist except for a few
nerds in Boulder and their time-keeping buddies around the world.


I'm no buddy to any time-keeper, maybe I should find some! (:

Pete
Jul 19 '05 #7
sh********@rediffmail.com (shoba) wrote in message news:<ed**************************@posting.google. com>...
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


<http://dinkumware.com/htm_cpl/time.html>

Store your number of seconds in a time_t variable and pass it to one
of the functions that takes a time_t (or time_t *); then process the
result.

BTW: All C and C++ books should have a section about time functions...
Doesn't yours?

- Shane
Jul 19 '05 #8


Peter Gregory wrote:

Karl Heinz Buchegger wrote:


shoba wrote:

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
...


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.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 19 '05 #9


osmium wrote:


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.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim | last post by:
I need to get the number of seconds when subtracting two date/times. With the code I am using below I subtract the two date/times and end up with a total of days like "1.56". Then when I multiply...
2
by: FN | last post by:
I'm new to javascript and internet research is turning up weird things. I just want to add 5 seconds to a date value. this = new date() // I believe this sets the time, too, right? //now how...
3
by: nriesch | last post by:
In the documentation, the "Second" property of class DateTime is a value between 0 and 59. In UTC time, approximately every year of so, a leap second is added at 00:00:00 UTC, so as to account...
1
by: Prabhu | last post by:
Hi, Can any one help me getting Seconds elapsed from a given date time to current time in .Net?. for e.g. Suppose assume a given time date time "01-Jan-2000 00:00:00", I should get the...
3
by: james | last post by:
I am working with a very old database system (building an import/export routine) that stores the time in seconds. I have been able to convert the seconds to correct time (thanks to a lot of help in...
4
by: Dr John Stockton | last post by:
I'm starting a new thread, for clarity. I'm assuming that it's ECMA-262 3rd Edn (1999) that we should be using for Web pages; that 4th Edn (what's its present status? is it available?) is too...
8
by: Ryan | last post by:
Hello, I'm new to Access and DB's in general. I've taken over some light duty support for a lab information system we use in house. Most of our dates are reported as "10/31/2006 12:30:00 PM"...
1
by: Manogna | last post by:
hi! all, mine is a Free bsd system. I want to convert the date to seconds. i used the date +%s command for conversion. but in that it converting the date in seconds including the...
3
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have various times formatted like 00:00:00, so for example, 01:32:05 would be one thirty-two with five milliseconds. I need to convert this into seconds (an integer). First of...
2
by: maxin | last post by:
Hi, I have some date time in xml file: <?xml version="1.0"?> <ProductionPerformance> <ActualStartTime>2008-12-07T01:00:00</ActualStartTime>...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.