A javascript bookmarklet for converting timestamps

I spend a lot of time working with timestamps (unixtime aka epoch) in phpMyAdmin, and got really tired of either cut-and-paste:ing the timestamps to my home-made timestamp converter or adding “FROM_UNIXTIME(created)” to the SQL queries to get the timestamps in a readable format…

The other day I got the idea to make a bookmarklet that does the conversion for me, and voilá! All you have to do is mark the timestamp and click the “Convert” bookmarklet. You’ll get an input field if you don’t mark anything.

Here’s the bookmarklet:
Convert timestamp (Bookmark the link, don’t click it!)

Please let me know if you find it useful or think of a way to improve it.

One Response to “A javascript bookmarklet for converting timestamps”

  1. Peter says:

    To make it usable in Google Chrome or the Iron browser you need to change the conditions a little:

    javascript:q=document.getSelection();if(q==”)for(i=0;i<frames.length;i++){q=frames[i].document.getSelection();if(q!=”)break;}if(q==”)void(q=prompt(’Enter timestamp:’,”));if(q!=”){d=new Date;d.setTime(q*1000);alert(d.toLocaleString())};

Leave a Reply