DAtum

Entrepreneurship, Software and the business of technology

Timestamp quickies

To get the current timestamp on your linux machine  (oddly has some problem on my customized zsh shell. works fine on bash)

date +%s

To convert timestamp to date format on your linux machine

date -d @<timestamp>

Date to timestamp is

date -d “Dec 21, 2011 22:00:01″ +%s

and for heaven’s sake when you are using UNIX_TIMESTAMP() function in mysql, please take care about your TZ difference between your OS and mysql.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.