bash字符串到目前为止

Mar*_*kus 6 bash formatting datetime

有没有机会将字符串转换为bash中的日期?例如:我有一个时间格式:"%Y-%m-%dS%H:%M:%S".这种字符串的一个例子是"2009-06-24S12:34:56".我需要在bash中将此字符串转换为日期(unix时间戳).我怎样才能做到这一点?

Mat*_*lin 15

使用

date --utc --date "<input string>" +%s
Run Code Online (Sandbox Code Playgroud)