unix-timestamp

MySQL and international dates

Say I have multiple servers in multiple locations and I want to use MySQL's datetime type for the field date and I always want to have the field date have the UTC timestamp so I would execute a UTC_TIMESTAMP() when I add it to the database. Now say I want to have MySQL output the UNIX TIMESTAMP for it. When I do this on Server A I get t...

unix timestamp to boost::posix_time::ptime

I need to convert double with number of seconds since the epoch to ptime. I'm prety sure there must be an easy way to do this, but I couldn't find anything. Thanks. Edit: The original timestamp is floating point. I can't change it and i don't want to lose the sub-second precision. ...

Easiest Way to Generate Unix timestamp?

Related question is "Datetime To Unix timestamp", but this question is more general. I need Unix timestamps to solve my last question. My interests are Python, Ruby and Haskell, but other approaches are welcome. What is the easiest way to generate Unix timestamps? ...

django Datefield to Unix timestamp

Hello In a model I have a such field: mydate = models.DateField() now a javascript graph function requires unix timestamp such as "1196550000000", how can I return the unix timestamp of my mydate input. Thanks ...

How to get UNIX_TIMESTAMP to not offset a datetime field when in different time zones?

I have built a small forum where users can post messages. My server is in the United States, but the userbase for the forum is in Taiwan (+15hrs). When someone posts to the form, I store the time in my mySQL database in the format YYYY-MM-DD HH:MM:SS. When I look in the database, the time displays the proper time (the time that the pe...

Get timezone offset in PHP given a unix timestamp

I have a Unix timestamp that comes from a database that is (unfortunately) in a timezone with a certain of either +3600 or +7200, depending on if it's DST or not. This has never been a problem before, but our website is currently moving to a more international audience and because of Javascript interaction with said timestamps, I need to...

PHP equivalent of UNIX_TIMESTAMP() of MySQL?

In MySQL: select UNIX_TIMESTAMP('2009-12-08 21:01:33') ; I need to get the value from PHP. ...

JS timezone conversion

In Javascript, I have a timestamp which I'm handling like so: var origUnixTimestamp = (date * 1000); Along with this timestamp I have a UTC offset (-5, although this is variable). I'm looking to convert origUnixTimestamp to the users UTC offset, using Date's getTimezoneOffset() method. I'm just wondering how I take into account the or...

recursive timestamp update in unix

Hi, When I create a directory say d1 and after 5 seconds d1/d2, then d1 timestamp gets updated to that of d2. After 5 seconds, when I create d1/d2/d3, only d2 timestamp gets updated to d3 but not that of d1. Basically, my requirement is that not only the parent folder but all the folders from root to parent folder must get updated with...

Use MySQL to determine if today is a user's birthday

I have all users' birthdays stored as a unix timestamp and am wanting to send out e-mails each day to users that have a birthday that day. I need to make a MySQL query that will get all of the rows that contain a birthday on today's date. It seems like this should be fairly simple, but maybe I am just overcomplicating it. ...

How to convert COledatetime to unix time / php time?

How can I convert a COleDateTime::GetCurrentTime() to a unix time stamp or more specifically I want to convert the value so I can use it in PHP with the date() function? ...

In Doctrine ORM, how can I sum seconds to a timestamp field?

I have a starts_at field that keeps a timestamp with the moment something starts. Also, I have another field seconds_long that represents the amount of seconds that the event lasts. I need to select all unfinished events but I just can't find a way to sum the starts_at and seconds_long fields. I first tried to sum them, expecting Doctri...

How can I work with dates before 1900 in PHP?

I am using PHP and jQuery to build an interactive timeline which needs to display dates between 1500 and 2020. I usually use PHP's strtotime function when working with dates, but it does not work for dates pre-1900. The dates will come from a MySQL database, and are formatted as strings such as "January 31, 1654" (this may not be the id...

Getting the day from a Unix timestamp (PHP)

How do I get the day (1-7) from a Unix timestamp in PHP? I also need the day date (1-31) and month (1-12). ...

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

How do I find the unix timestamp for the start of the next day in php?

I have a unix timestamp for the current time. I want to get the unix timestamp for the start of the next day. $current_timestamp = time(); $allowable_start_date = strtotime('+1 day', $current_timestamp); As I am doing it now, I am simply adding 1 whole entire day to the unix timestamp, when instead I would like to figure out how many ...

Check whether the string is a unix timestamp

I have a string and I need to find out whether it is a unix timestamp or not, how can I do that effectively? I found this thread via Google, but it doesn't come up with a very solid answer, I'm afraid. (And yes, I cribbed the question from the original poster on the aforementioned thread). ...

MySQL: What's the best to use, Unix TimeStamp Or DATETIME

Hello, Probably many coders want to ask this question. it is What's the adventages of each one of those MySQL time formats. and which one you will prefer to use it in your apps. For me i use Unix timestamp because maybe i find it easy to convert & order records with it, and also because i never tried the DATETIME thing. but anyways i'm...

SQlite: Column format for unix timestamp; Integer types

Original problem: What is the right column format for a unix timestamp? The net is full of confusion: some posts claim SQLite has no unsigned types - either whatsoever, or with exception of the 64bit int type (but there are (counter-)examples that invoke UNSIGNED INTEGER). The data types page mentions it only in a bigint example. It als...

SQL order by oldest from Unix Timestamps

Hello. How do I use SQL to order results by oldest first? I am using unix timestamps. Thanks. ...