Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Two digit year with DateTime?

by haukex (Chancellor)
on Mar 11, 2019 at 11:49 UTC ( #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
Node Status?
node history
Node Type: note [id://1231118]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2019-09-22 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (273 votes). Check out past polls.

    Notices?