Many times we look at the data in the database, or the data in other people's systems need to be time-stamped to query, or the result of the query is a timestamp. There are times when you need to enter a timestamp for the query condition. My previous approach is to use the online tool to complete, and later with the Mac, I think directly with the command line to solve the good, do not have to open a browser every time the trouble (actually dozen command unfamiliar also trouble)
Here is the operation under the Mac, mainly with the date this command, more usage with the man command to view
string format time to timestamp
We know that the date command can directly convert the current time to a timestamp
# date +%s1436781527
And here we turn our defined time into timestamps.
# date "%Y-%m-%d %H:%M:%S""2015-07-13 18:02:00""+%s"1436781720
In fact this slightly complicated if hand hit
Time stamp to time
But the time stamp becomes readable time form is very simple, Mac and CentOS a little different
These two commands are really short and good to remember
Copyright NOTICE: This article is Orangleliu (http://blog.csdn.net/orangleliu/) original article, the article reproduced please declare.
[linux]date command timestamp and time conversion