Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: Finding the difference between two dates including milliseconds (updated)

by haukex (Archbishop)
on Jan 09, 2017 at 06:33 UTC ( #1179203=note: print w/replies, xml ) Need Help??

in reply to Re^2: Finding the difference between two dates including milliseconds
in thread Finding the difference between two dates including milliseconds

Hi Anonymous,

AFAIK DateTime doesn't accept strings at all; I'm not sure where you're getting that specific format from? Again, please show the code you are trying, along with some sample input, the expected output for that sample input, and the actual output of the code including exact error messages, if any - see How do I post a question effectively?

DateTime::Format::Strptime will accept the data in almost any format including the one in the OP, but you'll have to build an appropriate pattern according to its documentation. So something like "%Y-%m-%d ..." - scroll down in the documentation to see all the different tokens and pick the ones appropriate for your format.

Update: Hint: Super search is your friend, among the first search results you'll find example code posted by myself and others.

Update 2: Hm, I'm guessing you may have gotten the string "Mon Mar 27 05:54:08 CDT 2009" from this StackOverflow post. Note that that code uses Time::ParseDate, and not DateTime. Follow the links I've given you and you'll find the appropriate documentation including example code.

-- Hauke D

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2022-12-09 02:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found