unixtime

Getting "unixtime" in Java

Date.getTime() returns milliseconds since Jan 1, 1970. Unixtime is seconds since Jan 1, 1970. I don't usually code in java, but I'm working on some bug fixes. I have: Date now = new Date(); Long longTime = new Long(now.getTime()/1000); return longTime.intValue(); Is there a better way to get unixtime in java? UPDATE Based on John...

Best practice for storing the date in MySQL from PHP

I've been using the unix timestamp all my life. I like it because it's easy to compare, it's fast because I store it as an integer. And since I'm using PHP, I can get any date/time format with date() function from the unixtimestamp. Now, some people are saying that it's best to use the DATETIME format. But besides the more suited name,...

Get the unix timestamp of midnight on the previous Wednesday

How would I go about finding the unix timestamp of midnight of the previous Wednesday? My only approach would be to get the day index and day number of today, and subtract the difference, but I can think of several scenarios where this would fail, for example, early in a month before a Wednesday has happened. I guess, more concisely, ho...

SQL Server function to convert Unix time to local datetime

I'm looking for an efficient SQL Server function (in my case 2005) to convert a unix time value into a SQL Server datetime, using local time (particularly taking account of summertime adjustments - i.e not just adding 01/01/1970 in seconds) ...

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

How to decompose unix time in C

This seems like something no one should ever have to do, but I'm working on a kernel module for an embedded system (OpenWRT) in which it seems that time.h does include the timespec and time_t types, and the clock_gettime and gmtime functions, but does not include localtime, ctime, time, or, critically, the tm type. When I attempt to cas...

easter_date() in JavaScript

Hi all! I'm making a calendar generator in JavaScript. I need the Unix Timestamp for easter day midnight, for a given year. Can anyone tell me how I need to do that (in JavaScript)? Thanks in advance. PHP's function can be found here: http://www.php.net/easter%5Fdate ...

Unixtime & mysql

Hi guys, I have a field on my table which is called X, and I store unixtime(php -> time()). My question is: How can I list all the months from my DB, something like: 6.2009 8.2009 etc.. And my second question is: How can I make a query to list all the informations based on a month and year on the same field X(i store unixtime),...

convert date to unixtime php

I have a form which posts date information month, day, yeah, hour, minute, am/pm. How do i encode/decode this to and from unixtime using php? ...

Parsing unix time in C#

Is there a way to quickly / easily parse Unix time in C# ? I'm brand new at the language, so if this is a painfully obvious question, I apologize. IE I have a string in the format [seconds since Epoch].[milliseconds]. Is there an equivalent to Java's SimpleDateFormat in C# ? ...

Handling time zones in Cocoa

I just want to clarify if I am understanding how dates & time zones work. Basically, I have a date string @"2008-07-06 12:08:49" that I want to convert to an NSDate. I want this date and time to be in whatever the current user's time zone is set in. So if they are in GMT or HST, it's still 12:08:49. If I have date in unix form 12153821...

How to convert 2010-03-01 to Unixtime

How can i convert 2010-03-01 to unixtime like 1267452738 ...

Convert String To date in PHP

How can I convert this string 05/Feb/2010:14:00:01 to unixtime ? ...

How to convert Regular Date to unixtime in Javascript?

How can i convert date which looks like this 12092008 to unixtime like this 1221215809 ...

PHP: How to determine Unix Timestamp of midnight tomorrow?

I have the following code to determine the unix timestamp of midnight tomorrow. It seems pretty hacky to me and I wondered if anyone had a more elegant solution. date("U", strtotime(date("Y-m-d 00:00:00", strtotime("tomorrow")))); ...

javascript unixtime one minute in front

Hi I'm passing a unixtimestamp to a javascript IF statement, can anyone tell me how to generate a unixtimestamp one minute in the future with javascript. Anyhelp would be helpful. Thanks ...

Mysql: Convert DB from local time to UTC

I need to convert an existing (datetime fields) db from local time ut UTC. The values are stored ad datetimes on a server with time zone CET (+1) (with summertime +2). When selecting data I use UNIX_TIMESTAMP(), which magically compensates for everything, ie, time zone shift and dst (if i've read the docs right). I'm moving the db to a...

What is the last Unix time?

What is the last Unix time in decimal? I'm going to set it as the expiration date of cookies (using PHP). Is it possible to cause problem? ...

Convert from unixtime at command line

Is there a quick, one-line way to convert a unix timestamp to a date from the unix command line? I've searched through the other posts, and most seem to be a way to convert in the context of a particular language, or to convert datestrings into unixtime. I'm looking for a way to do the reverse at the command line. 'Date' might work, e...

Help with a MySQL Unix timestamp Query

I am trying to create a custom MySQL for use with the Expression Engine CMS. The purpose of the query is to display events that are happening today or in the future. The problem is that the EE field type that allows you to put in the date and converts it into a unix timestamp. If I pick the 26th July it puts in the date value "25th July...