Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my $adate = "2017-01-29 11:30:07.370"; # more direct way, but returning a "1". my $a_new_datetime = ( $adate =~ s/(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\ +d{2})(.*)/$2-$3-$1 $4:$5/ ); print "\n 1 - $a_new_datetime\n\n"; my $new_datetime = $adate; $new_datetime =~ s/(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2})(.*)/$2-$3- +$1 $4:$5/; print " 2 - $new_datetime\n\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Assigning a parsed date to a variable
by kennethk (Abbot) on Mar 30, 2017 at 18:46 UTC | |
|
Re: Assigning a parsed date to a variable
by AnomalousMonk (Archbishop) on Mar 30, 2017 at 19:30 UTC | |
by Anonymous Monk on Mar 30, 2017 at 20:00 UTC | |
by Laurent_R (Canon) on Mar 30, 2017 at 21:48 UTC | |
by AnomalousMonk (Archbishop) on Mar 30, 2017 at 23:19 UTC | |
|
Re: Assigning a parsed date to a variable
by AppleFritter (Vicar) on Mar 30, 2017 at 21:38 UTC | |
|
Re: Assigning a parsed date to a variable
by 1nickt (Canon) on Mar 30, 2017 at 21:47 UTC | |
by shmem (Chancellor) on Mar 30, 2017 at 21:54 UTC |