timestamp

How can I compare dates in different formats in Perl?

Can anyone help me how to convert this date format "Mon, 24 Aug 2009 17:00:44 +0800" into something like this, "2009-08-24 17:00:44" in Perl? I've been browsing in CPAN for modules, but still I wasn't able to find what I was looking for. The first format is retrieved from an email account using Mail::POP3Client. The other one is from a q...

JPA set TIMESTAMP field to CURRENT_TIMESTAMP when persisting

I have a TIMESTAMP column on a table that is set to null when a record is initially inserted. I would like to update the value to the current time. My generated entity has a set method for the field as such: setCloseDate(Timestamp closeDate) However I do not want to generate/specify the timestamp from java code. Is there any way to...

Incorrect result for date comparison (to a timestamp column) in mysql

I've been having some 'strange' results while comparing dates. table1 has two rows with TIMESTAMPS values 2009-08-26 23:39:56 and 2009-08-27 00:01:42 When I make this query: select * from table1 c INNER JOIN table2 r ON r.table1_id = c.id WHERE DATE(c.authorization_date) = '2009-08-26' it returns both rows (when it only should have re...

How to get accurate high-precision timestamp on Intel processsors

The RDTSC (read time-stamp counter) can be used, but on newer processors that do dynamic clock adjustment, the count of clock cycles returned does not reflect an exact duration of time. I suppose dynamic clock adjustment can be disabled, but then on new processors like Nehalem any speed-up advantage is lost. Is there any high-precision...

Time synchronization in java

Hi there! Inside a for-loop I'm controlling the simulation-step-based traffic simulator SUMO by retrieving and processing information of vehicles. To make sure that my program simulates in "real-time" (1 simulation-step = 1 second) I want to sleep my program after the processing phase until the next time step begins. To get better resul...

extract date from datetime stamp

Anyone know how to extract the date from a datetime stamp as part of the where clause? eg. select * from tableA where date between '01/08/2009' and '31/08/2009' (Date is a timestamp!) Many thanks, Fiona ...

How to change the format of timestamp in CakePHP?

In my application,I retrieve a timestamp from the table which is of the format 2009-08-18 12:09:01. I need to change this to August 18th,2009 or 18 Aug,2009. How to achieve this in CakePHP? Are there any built in methods? ...

Subsonic 3.0 with timestamp field in SQL 2005

Hello, I have a timestamp field in a table and when i create a new instance of my object, set some fields, do not set the timestamp field and use the .Save(), i get an error saying that i cannot set an exlicite value to a timestamp field during an INSERT. How can i have SubSonic not save anything in that perticular field? Thank you ...

PHP - Upload 6 Images (MAX 1mb per file)

Hi I was wondering what the best way to send 6 'file' inputs to a php page would be... and how to process them, i used this website to understand uploading one file PHP Tutorial - File Uplaod Also, i want to name each of the 6 images with a time stamp for example below... 00000000 00000001 00000002 00000003 00000004 00000005 Basical...

How to get timestamp of tick precision in .NET / C#?

Up until now I used DateTime.Now for getting timestamps, but I noticed that if you print DateTime.Now in a loop you will see that it increments in descrete jumps of approx. 15 ms. But for certain scenarios in my application I need to get the most accurate timestamp possible, preferably with tick (=100 ns) precision. Any ideas? Update: ...

Converting timestamp to time ago in php e.g 1 day ago, 2 days ago...

hi everyone, i am trying to convert a timestamp of the format: 2009-09-12 20:57:19 and turn it into something like '3 minutes ago' with php. I found a useful script to do this, but I think its looking for a different format to be used as the time variable. The script I'm wanting to modify to work with this format is: function _ago($tm...

Is SQL Server Timestamp deprecated and what to use in replacement

The T-SQL MSDN page states The timestamp syntax is deprecated. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Does this mean to suggest that the SQL Server Timestamp data type is ...

How to Declare timestamp as variable and convert to ddmmyy format.

I have a date issue here. I have a timestamp field in mysql table called filedate. However I have tried several times to declare it and also convert it to a dd-mm-yy format. Unfortunately when I load it the date is still in timestamp format and when I then upload it claims I haven't declared the variable filedate. Any assistance pointin...

Timestamp updating in table with REPLACE INTO

I have a plus/minus system where a user can add one or minus one away from a blog post. My database (MySQL) table looks like this: userid entry id vote - which is +1 or -1 timeStamp I have set the timeStamp to default to CURRENT_TIMESTAMP. I have to methods plus() and minus(). Both do the same thing but one inserts +1 into 'vote' and...

Consuming Java Webservice TimeStamp from .net and WCF

We are trying to talk to a (possible)Java WebService from .NET 3.5 using WCF. The WebService defines a Timestamp object which seems to be a datetime without the decimal milliseconds. WCF decided .NET would use a datatime as the object backing in the proxy class. When sending objects with the timestamp to the Java WebServer the datetim...

Validating Timestamp overlaps with PHP

Hello all. My database holds date, start and end variables. In my code I grab the start and them as the user selects them, and convert them to timestamps like so (all inside a foreach loop).. $selectionDate = strtotime($timeQry['date']); $startTimes[] = strtotime($timeQry['start'],$selectionDate); $endTimes[] = strtotim...

PHP swap month and day in timestamp

Hey Guys, Right. I was inserting a load of data into a MySQL DB and used the following to generate the timestamp: $stamp = mktime($t[0], $t[1], $t[2], $d[2], $d[1], $d[0]); Unfortunately, the day and month were mixed around, and below is the correct timestamp. $stamp = mktime($t[0], $t[1], $t[2], $d[1], $d[2], $d[0]); It is about ...

How to convert a GMT timestamp to Unix timestamp (javascript)

I'm parsing an rss feed and each entry has a timestamp such as this: 2009-09-21T21:24:43+04:00 Is there any way to convert this date format to a unix timestamp with javascript? I just want to be able to record the latest rss entry date, but I need to standardize the time to GMT time or Unix timestamp to do this. ...

How to get a timestamp older than 1901

I'm trying to find to accurately count the number of seconds since Jan 1, 1850 to the present in a couple of languages (JavaScript, C++, and Python [don't even ask, I stopped asking these questions long ago]). Problem is the platforms store timestamps as 32-bit signed integers, so I can't get a timestamp for dates older than 1901 to eas...

Calculating a month as a "between" period in java

I want to select records that have a created date between the first and the last day of a given month. I calculate the month with begin and enddate the following way: The Date "month" is just a random date inside the timeframe Calendar cal = Calendar.getInstance(); cal.setTime(month); int endday = cal.getActualMaximum(Calendar.DAY_OF_M...