Abstract:
1) Human readable time to epoch time:
date +%s #Mon Aug 27 03:38:28 CST 2018 ==> 1535312308
2) epoch time to Human readable time
perl -le 'print scalar localtime $ARGV[0]' 1535312308
Mon Aug 27 03:38:28 CST 2018
date -d "25 JUN 2011" +%Y%m%d
output:
20110625
date +%s
date;date +%S; date +%s
Mon Aug 27 03:38:28 CST 2018
28
1535312308
perl -le 'print scalar localtime $ARGV[0]' 1535312308
Mon Aug 27 03:38:28 CST 2018
how to convert time stamp to seconds in bash
echo "00:20:40" | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }'
output:
1240
how to find the epoch time for specific day:
https://www.epochconverter.com/
reference:
https://unix.stackexchange.com/questions/2987/how-do-i-convert-an-epoch-timestamp-to-a-human-readable-format-on-the-cli
Sunday, August 26, 2018
how to convert current time in date as second or convert time stamp to seconds in bash/linux/ubuntu
Labels:
time conversion,
timestamp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment