epoch

How do I compare an epoch time against 24 hours ago in SQL Server?

I am using MS SQL Server 2005, I have dates stored in epoch time (starting 1970) I need to create a statement that will affect any record that has not been updated in the last 24 hours. ...

mm/dd/yyyy format to epoch with PHP

I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling with converting that date into the unix epoch format to add...

Print Epoch Time in Different Languages

As you may know, tonight, at exactly 23:31:30 UTC, Epoch Time will reach 1234567890! Hurray! One way of watching epoch time is by using Perl: perl -le 'while(true){print time();sleep 1;}' Can you do the same in another programming language? ...

What's the result of the SQL statement "SELECT DATEADD(s,1234567890, '19700101')"?

For some reason, my SQL installation isn't working :) SELECT DATEADD(s,1234567890, '19700101') Maybe this site would help (link from Moose). ...

How do I convert a date into epoch time in Perl?

Solaris 10 doesn't seem to like me a lot. I am trying to run a simple script to accept date and return epoch of that date: #!/usr/bin/perl -w use strict; use Time::ParseDate; my $date1 = "Mon Mar 27 05:54:08 CDT 2009"; #Convert to seconds since start of epoch my $time1 = parsedate($date1); print $time1; Works perfectly fine on RHEL ...

Javascript Unix Epoch Time Strangeness

I have a portion of script that calculates the days remaining to an event: var currTime = Math.round(new Date().getTime() / 1000.0); var dispDate = event.find('UnixEpoch').text(); var diffDate = (dispDate - currTime) / 86400; var dateRound = Math.round(diffDate) - 30; The first line gets the current Unix Epoch time and shaves off the ...

Given date and time, how do you get the Epoch time?

I have int year, month, day, hour, min, sec How can I get the epoch time in C++? I am having difficulty figuring it out using Boost, any examples or alternative ways to do it? ...

Calculating Future Epoch Time in C#

I was able to find example code to get the current timestamp in Linux Epoch (Seconds since Midnight Jan 1st 1970), however I am having trouble finding an example as to how to calculate what the Epoch will be in the future, say for example 10 minutes from now, so how can I calculate a future time in Linux Epoch? ...

How to add integer column with default of unix timestamp (epoch) in PostgreSQL?

This doesn't work: create table event ( ... time int default date_part('epoch', timestamp 'now'), ... ); ...

Get Current date in epoch from Unix shell script

Hi, How to get the current date value in epoch i.e., number of days elapsed since 1970-1-1. I need solution in unix shell script. ...

Use Unix timestamp in Doctrine Timestampable

How do I use Unix timestamps with the Doctrine Timestampable behavior? I found the following code snippet here, but I'd rather not manually add this everywhere: $this->actAs('Timestampable', array( 'created' => array('name' => 'created_at', 'type' => 'integer', 'format' => 'U', 'disabled' => false, 'options' => ar...

Best way to convert epoch time to "real" date/time

What I want to do is convert an epoch time (seconds since midnight 1/1/1970) to "real" time (m/d/y h:m:s) So far, I have the following algorithm, which to me feels a bit ugly: void DateTime::splitTicks(time_t time) { seconds = time % 60; time /= 60; minutes = time % 60; time /= 60; hours = time % 24; time /= 24;...

Treat axis as date/time (epoch)

I'm generating a graph with gnuplot of activity over the last twenty four hours, but the time axis looks really bad because it's trying to fit the long number for every five minutes in the last day. Is there any way for gnuplot to treat the x-axis as an epoch time, and mark every hour or so? ...

Get Diffrence Between Two Times (Unix Epoc)

You know when it's late in the night and your brain is fried? I'm having one of those nights right now, and my function so far is not working as it should, so please take a look at it: (I should note that I'm using the PHP 5.2.9, and the function / method DateTime:Diff() is not available until PHP 5.3.0. <?php function time_diff($ts...

Epoch Time (Ticks since 1970) - Mac vs. Windows

I have some C# web services that return JSON. The .NET JavaScriptSerializer returns dates in Epoch Time (milliseconds since 1970). On any Windows machine, the web based application processes the milliseconds back into the proper date without a problem. On my Mac, the dates are sometimes off by 1 hour. Not every time. Only sometimes....

How can I change the timezone of a datetime value in Perl?

Using this function: perl -e 'use Time::Local; print timelocal("00","00","00","01","01","2000"),"\n";' It will return an epochtime - but only in GMT - if i want the result in GMT+1 (which is the systems localtime(TZ)), what do i need to change? Thanks in advance, Anders ...

How to get seconds since epoch (1/1/1970) in VBA?

How can I get seconds since epoch (1/1/1970) in VBA? ...

jQuery Datepicker - How can I format the date as an epoch timestamp (in seconds NOT milliseconds)

I'm using the jquery datepicker plugin to set a date field that is stored as an epoch timestamp in the db (the field, publish_time, maps directly to the table schema). It seems that Datepicker only supports epoch in milliseconds, and not seconds. Its aggravating that it supports milli & nano seconds, but not seconds. Are there any quic...

Returning Time Components with Modulus

Someone does 20 Hours 42 Minutes & 16 Seconds in one shift totaling 74536 seconds. How do I get the hours from number of seconds the person has done for that shift? 20 * 60 * 60 = 72000 42 * 60 = 2520 16 = 16 + ----- Total = 74536 ____________________________...

Epoch is not epoch if do a new Date(0L). Why ?

My problem is pretty straigtforward explained : if i do this : public class Main { public static void main(String[] args) throws Exception { Date d = new Date(0L ); System.out.println(d); } } I get the following output : Thu Jan 01 01:00:00 CET 1970 According to the doc, i was expecting : Thu Jan 01 00:00:00 CET ...