Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Two digit year with DateTime?

by haukex (Archbishop)
on Mar 11, 2019 at 11:49 UTC ( [id://1231118]=note: print w/replies, xml ) Need Help??


in reply to Two digit year with DateTime?

I would recommend against a two-digit year, but if you must, see DateTime's strftime method:

use warnings; use strict; use DateTime; my $start_of_week = DateTime->today()->truncate( to => 'week' ); for ( 0..6 ) { my $teden = $start_of_week->clone()->add( days => $_ ); print $teden->strftime('%m-%d-%y'), "\n"; } __END__ 03-11-19 03-12-19 03-13-19 03-14-19 03-15-19 03-16-19 03-17-19

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 05:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found