Bash string to date

Is it possible to convert a string to a date in bash? For example: I have a time format: "%Y-%m-%dS%H:%M:%S" . An example of such a line is "2009-06-24S12:34:56" . I need to convert this string to a date (unix timestamp) in bash. How can i do this?

+6
bash datetime formatting
source share
1 answer

Using

 date --utc --date "<input string>" +%s 
+15
source share

All Articles