epoch

Pulling a timestamp from an XML feed with PHP but seem to be to many digits

I am pulling a timestamp from a feed and it gives 12 digits (1269088723811). When I convert it, it comes out as 1901-12-13 20:45:52, but if I put the timestamp into http://www.epochconverter.com/ it comes out as Sat, 20 Mar 2010 12:38:43 GMT, which is the correct time. epochconverter.com mentions that it maybe in milliseconds so ...

Storing date and time as epoch vs native datetime format in the database

For most of my tasks I find it much easier to work with date and time in the epoch format: it's trivial to calculate timespan or determine if some event happened before or after another, I don't have to deal with time-zone issues if the data comes from different geographical sources, in case of scripting languages what I usually get...

Using DateTime in PHP, generating bad unix epoch time from $foo->format('U')

I can't seem to get the correct Unix epoch time out of this PHP DateTime object. $startingDateTime = "2005/08/15 1:52:01 am"; $foo = new DateTime($startingDateTime, new DateTimeZone("America/New_York")); echo $foo->format('U'); which gives 1124085121 Which is Mon, 15 Aug 2005 00:52:01 GMT -500 (according to http://w...

Convert Unix Epoch Time to format HH:MM:SS without the date

I'm using SSRS 2005 and I need to convert time from a serial unix time like 3412.254263 to a duration like 166:12:35 where the second format is HH:MM:SS. All .NET code should work, but I can't find any function that does not include the date or does not treat the result as a duration. Any help would be appreciated! ...

Convert Unix Epoch Time to Seconds in SQL or .NET

First let me thank you all for your help. What I need is a function that takes in a EPOCH time stamp, like 1452.235687 and converts it to a readable timestamp like '01-01-1970 00:00:00'. More specifically I only need the time not the date. If at all possible I would prefer a .NET function instead of a SQL stored procedure. However an S...

Converting TIMESTAMP to unix time in PHP?

Currently I store the time in my database like so: 2010-05-17 19:13:37 However, I need to compare two times, and I feel it would be easier to do if it were a unix timestamp such as 1274119041. (These two times are different) So how could I convert the timestamp to unix timestamp? Is there a simple php function for it? ...

How do you convert epoch time in C#?

How do you convert epoch time in to real time in C#? ...

C++: How would I get unix time?

I need a function or way to get the UNIX epoch in seconds, much like how I can in PHP using the time function. I can't find any method except the time() in ctime which seems to only output a formatted date, or the clock() function which has seconds but seems to always be a multiple of 1 million, nothing with any resolution. I wish to ...

Wordpress doesn't allow me to post in really old dates (year 1800)

I'm making a timeline in Wordpress, and I'm trying to make a post with the date January 12, 1800, but Wordpress doesn't allow me. Apparently, it doesn't let me post anything before the year 1970. Is there any way to fix it? ...

How do I convert epoch time to normal time in Perl?

I am attempting to write a Perl script that parses a log where on each line the second value is the date. The script takes in three arguments: the input log file, the start time, and the end time. The start and end time are used to parse out a certain value on each line that that falls between those two times. But to properly run this...

What's the epoch of DateTime(Int64)?

What's the epoch of DateTime(Int64)? ...

convert epoch to time_t

I have a epoch in double and need to pass in to a function that takes time_t. How do I convert the epoch in double to time_t? I am on Linux with C++ code. Thanks. ...

In the database, why can't we just use "Long" integers for dates (millis since epoch)

I would like to use a Long datatype in the database to represent dates (as millis since epoch). The reason why, is that storing dates is so complex with the jdbc driver and Oracle engine. If you submit the wrong datatype in preparedStatement it casts a timestamp to a date (or vice versa) blowing your index, resulting in full table scans ...

Number of digits in Epoch time

I'm working on a machine which has some code running on it which sets the time when I set the password. The time set is epoch time, but it has 13 digits in it, and when I wrote a simple program to get the epoch time and ran it on my personal computer running linux, it returns the epoch time which has 10 digits. Would anyone know what the...

Pass settimeofday() epoch time?

Hi, Is it possible to pass settimeofday() my time_t/epoch time value, in C? Could someone give me an example of how I could do it ... my C skills are a little rusty :S Would it be: time_t time = somevalue; settimeofday(somevalue, NULL); I don't have admin access where I'm working and so can't test it out. Thanks in advance! ...

How to specify timezone in linux using C

Hi, I was trying to set the timezone of my system, and was trying to use settimeofday(), which takes a timezone struct as an argument, but just read that that struct is now obsolete (http://linux.about.com/library/cmd/blcmdl2_settimeofday.htm) How could I go about doing this? Thanks in advance. EDIT: Ugh, I feel really stupid. I crea...

Python: Initialize a datetime object with seconds since epoch

Hi, The time module can be initialized using seconds since epoch: >>> import time >>> t1=time.gmtime(1284286794) >>> t1 time.struct_time(tm_year=2010, tm_mon=9, tm_mday=12, tm_hour=10, tm_min=19, tm_sec=54, tm_wday=6, tm_yday=255, tm_isdst=0) Is there an elegant way to initialize a datetime.datetime object in the sa...

php mktime for epoch returns -3600, not 0

Hi If I run the following in PHP: echo mktime(0,0,0,1,1,1970); the returned value is -3600, not 0 as I expected. The server is UK based, it's currently 21 Sep (i.e. BST summertime) (though I wouldn't expect this to affect the epoch timestamp) and per php.info: "Default timezone Europe/London". Setting the daylight saving time fl...

Does Time.to_i always return number of seconds since EPOCH in UTC?

Is the timezone difference always ignored, regardless in which zone the time is expressed in? Intuitively, the number of seconds passed since EPOCH should be higher for those who are, for example, in UTC+2. However, this seems not to be the case. ...

Epoch to date is 3 years off

i get a epoch time returned from a webservice wich is about 3 years off in PHP but fine in javascript and the epochconverter.com JS: alert('book '+ new Date(1285565357893)); // returns a time this morning 27 sep 2010, Correct! PHP: echo strftime('%x', 1285565357893); // returns a date in 2013, Wrong ! Timezone is set ...