Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: DateTime formatting problem

by moritz (Cardinal)
on Apr 30, 2013 at 17:59 UTC ( #1031444=note: print w/replies, xml ) Need Help??


in reply to DateTime formatting problem

$start_date->strftime("%m%d%y"); print $start_date;

strftime does not modify the invocant ($start_date) in any way. Rather it returns a string that is the result of formatting the invocant.

Since you throw away the result of calling ->strftime, and then print $start_date again in the next line, I guess you haven't fully understood this principle.

So the answer is to work with the return value of the ->strftime call, not with the original object.

Replies are listed 'Best First'.
Re^2: DateTime formatting problem
by PerlSufi (Friar) on Apr 30, 2013 at 18:07 UTC
    Thanks. So on the first (tomorrow) it should return my start date as 040113 and my end date as 043013, right?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031444]
help
Chatterbox?
[pryrt]: 1nickt, sprintf "%.16e", $v will always give enough precision to see 1 ULP (the smallest fractional part) of a standard 64bit Perl NV*
[pryrt]: (*: for systems where $Config{nvsize}==8 )
[pryrt]: Thus, that's "enough precision" to tell the difference between 1.0 and 1.0+1ULP
[pryrt]: But in what circumstance does your problem arise? When, in Perl, does the integer 1 not work identically to the floating-point NV 1.0000000000000000 e0?

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2017-05-24 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?