in reply to Re^2: Using Time::Piece Strptime
in thread Using Time::Piece Strptime

Date formats in excel can be tricky. See Excel::Writer::XLSX::Utility

#!perl use strict; use Excel::Writer::XLSX; use Excel::Writer::XLSX::Utility; use Time::Piece; my $wb = Excel::Writer::XLSX->new( 'dates.xlsx' ); my $ws = $wb->add_worksheet(); my $fmt = $wb->add_format(); $fmt->set_num_format( 'dddd mmm dd, yyyy' ); my $date = '3/15/16, 00, Mar, 2016'; my $t = Time::Piece->strptime($date, '%D, %M, %b, %Y') ; my $xldate = xl_date_list($t->year, $t->mon, $t->mday); $ws->write( 0, 0, $xldate, $fmt ); $wb->close();
poj