Is it possible to convert time with ruby? My program prints the time stamp like this: 10/18/2107 14:08:09, but I want it to be like this: 2017 M10 18, Wed 14:
10/18/2107 14:08:09
2017 M10 18, Wed 14:
From the string you can parse it to DateTime passing the format, and then format the output string:
date_time = '10/18/2107 14:08:09' puts DateTime.strptime(date_time, '%m/%d/%Y %H:%M:%S') .strftime('%Y M%m %d, %a %H:%M:%S %Z')
Note it's Tuesday and the time zone it's specified as 00:00.