Issue
I have this datetime 04/01/2024 16:30:00, which implies to 4th Jan 2024 16:30:00, how can I convert 04/01/2024 16:30:00 to Jan 04 2024 16:30:00 in bash.
The server is in UK, below code:
date --date='TZ="Europe/London" 04/01/2024 16:30:00'
always returned to Mon Apr 1 16:30:00 BST 2024, but what I want is Jan 04 16:30:00 BST 2024
Solution
in case someone would like to now change date format by splitting, you can do below:
IFS='/' read -ra test_dt <<< "$you_input_date"
# date format for UK is dd/MM/YYYY
day="${test_dt[0]}"
month="${test_dt[1]}"
year="${test_dt[2]}"
startDtTm="$month/$day/$year"
Answered By - Andie Answer Checked By - Dawn Plyler (WPSolving Volunteer)