Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Comparing different timestamp formats

by tangent (Vicar)
on Oct 24, 2018 at 21:59 UTC ( #1224624=note: print w/replies, xml ) Need Help??

in reply to Comparing different timestamp formats

As haukex points out, you can use the database functions to calculate the difference. You can select the interval between now and the timestamp you have like this:
SELECT TIMESTAMPDIFF( MINUTE, STR_TO_DATE('Tue Oct 23, 2018 - 19:57:12','%a %b %d, %Y - %T'), NOW() );
That will return the difference in minutes - you can use SECOND as well. In your SQL query you might have something like this:
SELECT column_name, TIMESTAMPDIFF( SECOND, STR_TO_DATE(column_name,'%a %b %d, %Y - %T'), NOW() ) FROM table;

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1224624]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2022-01-24 04:22 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (64 votes). Check out past polls.