Re: Time Comparison Easier Than I'm Making them



Mathew Snyder wrote:
I've got an application which uses the format yyyy-mm-dd hh:mm:ss for its
timestamping. I'm trying to determine if the time a record was created was 5 or
more minutes before the time the script runs. Using DateTime->now I get a
timestamp of yyyy-mm-ddThh:mm:ss. I have no clue what the 'T' represents.

All I'm trying to do is take the hh:mm:ss portion of each timestamp and find the
difference yet I'm pulling my hair out trying to find the solution. Can someone
please just point me to what I can use? I'll figure it out from there.

Here is a verbatim snip of some code I recently did using the

use DateTime::Format::MySQL module

....it will strip the T:

$sql_date_end = DateTime::Format::MySQL->format_datetime($date_end);

Alternatively, you could also just do this:

$expire_date =~ s/T/ /; # convert to MySQL format

Regards,

Steve
.



Relevant Pages