April 5, 2011

How to convert Unix timestamps

It's been a long *time* since my last post, hence I thought I'd do a post that involves time. I often run into the situation where I have a Unix timestamp and I need to determine the date. You can use the following to do this.

mike@shiner $ date -d @1252278000
Sun Sep  6 19:00:00 EDT 2009

The following shows how to get the Unix timestamp for a particular moment in time.

mike@shiner $ date -d "2009-09-06 19:00:00" "+%s"
1252278000

2 comments:

  1. Nice. Many of my scripts need the current unix timestamp:

    now=`date +%s`

    ReplyDelete
  2. It’s a 3D printer that has the one physique chassis of the Ender 3 series, but with several Panties for Women of} key upgrades, most notably a completely redesigned Direct Drive extruder. Finally, if you're looking to print giant, Creality has the best giant format offerings of any consumer 3D printer brand. While these printers do cost substantially more than the smaller entry-level printers, they are much more reasonably priced than different giant format printers, that are primarily targeted for the business house. Do you need to get began in the great world of 3D printing know-how, but don't need to spend too much amount of} money? You can get began for as little as $100 (although things start to get higher over about $200). In the guide under, we current a batch of actually nice 3D printer choices for novices that will have you ever cranking out Baby Yoda replicas in no time.

    ReplyDelete