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

Re: Formats for date.

by BaldPenguin (Friar)
on Jun 28, 2005 at 17:48 UTC ( [id://470843]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Formats for date.

You could also use:
$currSysDate = sprintf("%02d/%02d/%04d",$mon,$day,$year);
But it should be noted that if you use this approach, no validation occurs. You could create a bad date;

Don
WHITEPAGES.COM | INC

Edit by castaway: Closed small tag in signature

Replies are listed 'Best First'.
Re^2: Formats for date.
by ikegami (Patriarch) on Jun 28, 2005 at 17:51 UTC
    Are you implying that strftime does validation? I can't find any documentation to support that. Validation isn't needed anyway, since he's printing out the result of localtime.
      Actually, what I was implying was that if the localtime was read and then a value such as month were to be incremented, then sprintf() would print out a bad date( i.e. 13/30/2005). You are correct in that passing localtime straight to strftime would not require validation, if any were to exist. Thanks.

      True validation could be accomplished using Date::Calc or DateTime or similar to increment the date values.

      Don
      WHITEPAGES.COM | INC

      Edit by castaway: Closed small tag in signature

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://470843]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.