timestamp

python mysqldb timestamp/unix_timestamp issue

trying to understand the subtleties of inserting data into a mysql tbl when dealing with unix_timestamp, and the timestamp def within the tbl using python v2.6, using the mysqldb lib i'm consistently getting the err/warning: TypeError: not all arguments converted during string formatting the test tbl looks like: DROP TABLE IF EXISTS ...

string to php timestamp

Possible Duplicate: convert any date string to timestamp without timezone I have a string that looks like this and want a php timestamp format. I can ask client to change format of the string if necessary. 2010/08/11 06:33:00 ...

DateTime::createFromFormat - php format issue

PHP - DateTime::createFromFormat — Returns new DateTime object formatted according to the specified format this works: $var = DateTime::createFromFormat('Ymd','20100809')->getTimestamp(); but this fails with "Call to a member function getTimestamp() on a non-object " $var = DateTime::createFromFormat('Y/m/d H:M:S','2010/08/09 07:47:0...

Getting timezone for JavaScript and PHP all mixed up.

I'm trying to synchronize the timezone between a PHP script and some JavaScript code. I want a PHP function that returns a timestamp in UTC. Does gmmktime() do that? On the JavaScript side, I have: var real_date = new Date(); real_date -= real_date.getTimezoneOffset() * 60000; real_date /= 1000; Does this convert the timestamp...

RIA Services + Entity Framework 4 + POCO's : 'The Timestamp field is required' error?

I've the following table definition in MSSQL: CREATE TABLE [User] ( [Id] bigint identity(1,1) NOT NULL, [Email] nvarchar(256), [PasswordHash] nvarchar(128) NOT NULL, [PasswordFormat] int DEFAULT ((0)) NOT NULL, [PasswordSalt] nvarchar(10) NOT NULL, [Timestamp] timestamp ) ; The EDMX property for Timestamp loo...

MySQL create time and update time timestamp

I am creating some tables where I want to store the time when a record was created and when it was last updated. I thought I could have two timestamp fields where one would have the value CURRENT_TIMESTAMP and the other would have CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP. But I guess I can't do this because you can have only 1 times...

Rails - Accessing timestamps from a lookup table

Hola all, I'm trying to get the values from timestamps created in a lookup table. Let's say I've got Ingredients and Recipes, and a table called ingredients_recipes, with ingredient_id, recipe_id, and then the timestamps. How can I get access to those timestamps? Basically, I need to know when a given ingredient was added to a recipe. ...

MySQL TIMESTAMP value greater than '2038-01-19 03:14:07'

I'm wondering what will happen after 2038-01-19 03:14:07 with table fields using TIMESTAMP as data type? I always preferred DATETIME but you apparently can't assign CURRENT_TIMESTAMP as default value to that type. I mean, 28 years is not so long when you think about it (in my opinion anyway)... So what will happen to all those TIMESTAMP...

Comparing Timestamps in Java to get difference in days

I'm retrieving two timestamps from a database (check_in and check_out). I need to compare the two to find out how many days have passed between the two timestamps. How can this be done in Java? ...

Compare two timestamps in mysql, then return a custom field

I'm building a small scale forum script in PHP, and I am having difficulty demonstrating the read/unread status of a given thread. So, I have a particularly gargantuan query which returns the thread information, including the date it was first posted in, the date it was last posted in (if any) as well as the date it was last looked at b...

Override Rails updated_at attribute

Hi, I would like to modify updated_at attribute so that every time record is updated it would only show date and hours while hours and minutes being zeros. Instead of 2010-08-13 11:04:12, there would be 2010-08-13 11:00:00. What is the most rational way to do this in Rails 2.3? Update The reason why I want to do what I have asked is ...

Need code critique for time interval test script PHP

Hey again! I'm trying to write a set of scripts that will run on a page only if it has been more than 15 minutes since they last ran. Basically, an automated script updates a database of mine every half hour--and a page which displays that information and updates session variables must obviously query the database whenever it is opened...

MySQL: how to get the difference between two timestamps in seconds

Is there a way I can make a query in MySQL that will give me the difference between two timestamps in seconds, or would I need to do that in PHP? And if so, how would I go about doing that? ...

How to store the timestamp as decimal(17,3) in mysql?

I try to generate a trigger, in the trigger statement I have to set a column of type decimal(17,3) with the actual timestamp or the seconds of unix timestamp, but could not find a solution. ...

subtracting timestamps

I thought this would be a really simple thing, but I'm having a hard time finding any answers! I have a support table, with added_on and closed_on fields that track when support tickets were opened and closed. I'd like to run a query that (closed_on - added_on) to show the duration a ticket was open. Both fields are timestamp format. T...

MySQL: Strange result when subtracting Date value and NOW()

I just tried to insert two rows with the current datetime and then calculated the elapsed time since that date. Here are the rows from my table after two insertions and using NOW() function to set the timestamp: mysql> select * from pendingActivations; +--------+------------+---------------------+ | userId | code | timestamp ...

How do you "concatenate" two 32 bits int to get a 64 bits long in Python?

I want to generate 64 bits long int to serve as unique ID's for documents. One idea is to combine the user's ID, which is a 32 bit int, with the Unix timestamp, which is another 32 bits int, to form an unique 64 bits long integer. A scaled-down example would be: Combine two 4-bit numbers 0010 and 0101 to form the 8-bit number 00100101...

LG internal GPS Timestamp is wrong

Hi all, I am developing a J2ME GPS tracking software. I am testing it on LG Touch Screen and i get the wrong timestamp. it's 10 years and 5 days different than the current date(now it show 2000 not 2010). I have done some search and see some people say there's some bug in LG GPS timestamp. Can anyone give me some advice on the work aro...

Recommended date format for REST API

Hi - I'm writing a app that exposes a REST API. Some of the query parameters will be date/time (accurate to second), and some of the responses will be timestamps (accurate to millisecond). The API implementation on the server is in Java. The client apps can be anything - java, javascript, .NET. The API returns XML or JSON data. Date/T...

Using dates in jQuery Flot display

I'm trying to use Flot to plot a graph with dates. I've followed the advice on this string: here but it doesn't seem to work for me. Here is my modified JavaScript (from that other question): $(document).ready(function () { var d1 = [[1262818800,100],[1262732400,100],[1262646000,100]]; var d2 = [[1262818800,23],[1262732400,2...