Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Difference between dates

by davido (Cardinal)
on Apr 20, 2015 at 04:49 UTC ( [id://1123988]=note: print w/replies, xml ) Need Help??


in reply to Difference between dates

Can't this be solved almost entirely within an SQL query?


Dave

Replies are listed 'Best First'.
Re^2: Difference between dates
by aaron_baugher (Curate) on Apr 20, 2015 at 07:56 UTC

    Yes. The OP's code doesn't seem to match his question, since it doesn't do any subtracting, but MySQL can give you the difference between two dates:

    SELECT id, DATEDIFF(lastlogin, dateadded) FROM order_details;

    Aaron B.
    Available for small or large Perl jobs and *nix system administration; see my home node.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found