220. Convert time from and to unix timestamp
Convert time from string to unix timestamp:
date -d "yyyy-MM-dd HH:mm:ss" +%s
The -d "time string" part can be omitted which takes the current time then.
Output of unix timestamp as time string:
date -d @0000000000
Where 0000000000 represents the unix timestamp.
Kategorie(n): Linux