"Asad" <asad.hasan2...@gmail.com> wrote in message 
news:cag3lskh4dphjg18c-jxmo8bcqfd+vix5tep1ytsp4_6pd6z...@mail.gmail.com...
Hi All , 

          I need  a regex to match the date : Sat Aug 25 08:41:03 2018 and 
covert into a format :    '%m/%d/%Y %H:%M:%S' 

Thanks, 


-- 

Asad Hasan
+91 9582111698

Hello Asad,

You could use Time::Piece to do this. (Although given a choice, I would use 
ā€˜%Y/%m/%d %H:%M:%S’ which sorts naturally in a sorting situation)

#!/usr/bin/perl
use strict;
use warnings;
use Time::Piece;

my $d = 'Sat Aug 25 08:41:03 2018';

my $dt = Time::Piece->strptime($d, '%a %b %d %H:%M:%S %Y');

say $dt->strftime('%m/%d/%Y %H:%M:%S');

Reply via email to