I have current date as 1/10/2010 I need to convert it into 1 October 2010. Is there any module to convert?
Use DateTime::Format::Strptime.
use DateTime::Format::Strptime;
my $Strp = DateTime::Format::Strptime->new(
pattern => '%d/%m/%Y',
time_zone => 'UTC',
);
my $dt = $Strp->parse_datetime('1/10/2010');
print $dt->strftime('%d %b %Y');
Edit: Thanks to @davorg for a hint with new.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With