Hi,
I am getting the below string as a input for date.
12/03/2013 11:02 AM
I want to change this date as 03-DEC-2013 11:02 AM.
Could you please help on this.
Thanks
Chelladurai
Hi,
I am getting the below string as a input for date.
12/03/2013 11:02 AM
I want to change this date as 03-DEC-2013 11:02 AM.
Could you please help on this.
Thanks
Chelladurai
if you have date -d
option
$ date -d "12/03/2013 11:02 AM" +"%d-%b-%Y %R %p"
03-Dec-2013 11:02 AM
Hello,
Here is one more approach. Let us say file name which is having input is change_data_format.
awk -F"/" '{
split("Jan,Feb,March,April,May,june,july,Aug,Sept,Oct,Nov,Dec",month,",");
print $2"-" month[$1] "-" $3}' change_data_format
Output will be as follows.
03-Dec-2013 11:02 AM
Thanks,
R. Singh
Hi Pamu,
Thank you so much, it working perfectlry
If you are using a modern version of the Korn shell:
$ printf "%(%d-%b-%Y %R %p)T\n " "12/03/2013 11:02 AM"
03-Dec-2013 11:02 AM