I needed to get the last modified date of a file using Bash. This can be easily achieved in the following way:

FILE_PATH="$USERPROFILE/sites/site/mysql.sql"
FILE_DATE_MODIFIED=`date -r $FILE_PATH "+%Y-%m-%d %H:%M:%S"`

echo "The file was last modified on $FILE_DATE_MODIFIED (local time)."

You can adjust the date format as needed by changing the "+%Y-%m-%d %H:%M:%S" part.

By default, the time zone that is used is the local machine’s time zone. However, you can easily change it to another time zone, like UTC, by adding TZ=UTC at the begining:

FILE_DATE_MODIFIED=`TZ=UTC date -r $FILE_PATH "+%Y-%m-%d %H:%M:%S"`