... dedicated to the pursuit of making money!

 

Converting Epoch Time

February 04, 2007

For whatever reason the powers that be decided that Unix systems should measure time in seconds since the epoch (or more commonly known as midnight UTC of January 1, 1970). Since most real work gets done on Linux/Unix systems, the unfortunate truth is that there is no way to escape the epoch (trust me, it will find you).

 

The problem here is that I hate dealing with epoch time. Mostly because I’m not cool enough to convert epoch time to UTC in my head. So if you are like me and want to convert epoch time to something more manageable, here is how to do it!

 

The two easiest ways to convert epoch time:

 

1) Use Perl

 

localhost # perl -e ‘print “”.localtime 1182309010′

 

2) Use Awk

 

localhost # awk ‘BEGIN{print strftime(”%c”,1182309010)}’

 

And there you have it. The two easiest ways I know to convert epoch time. If you know of any easier ways I’m open to suggestions… Enjoy :-)

 

 

What the future has in store

You can expect this site to change fairly regularly (probably a least once per week). I will be using it mostly as a way to centrally house my ideas and as a way to test new and/or exciting projects that I happen to be working on. If you'd like to see something on this site or have any sort of feedback please feel free to contact me.