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

Please post a working code snippet and a sample of the input data file if you want help cleaning up your strptime pattern. (see How do I post a question effectively?)

You can, in any case, eliminate the undesired time part of your output with:

my $date_sans_time = $date1->strftime("%A %b %e, %Y");
as I showed above.


update: added link
The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^4: Using Time::Piece Strptime
by GrorkGnom (Initiate) on Jan 26, 2016 at 21:29 UTC

    THANK YOU, THANK YOU, THANK YOU! With all the information you have shown me here and using the CPAN info for strptime and strftime, I've got my date displaying correctly now in my spreadsheet. What a pain!

    Here is the final code that did it. I had to do some manipulating to get it to finally work. Incidently, the raw date I was using from the text file is a Julian calendar date. I generated it from a mainframe job that outputs a set of commands to a text file.

    my $dfile = 'd1528235.txt'; open my $dfh, '<', $dfile; my $date; while ( <$dfh> ) { chomp; if ( not $date and $date = join '/', /=\((\d\d)(\d\d)(\d\d)/ ) { my $str1 = '$date'; my $date1; $date1 = Time::Piece->strptime($date, '%D, %M, %dhd, %Y') ; my $date2 = $date1->strftime("%A %b %d, %Y"); $worksheet->merge_range('A2:G2',$date2,$format5,);