Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.

Regards,
-- Hauke D


In reply to Re^3: Finding the difference between two dates including milliseconds (updated) by haukex
in thread Finding the difference between two dates including milliseconds by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-18 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found