FruitNotes beta
Your All-in-One Online Notebook
FruitNotes Blogs | Home  
Javascript - converting unix timestamp to local time format
Last updated at (Thu Jan 10 2008 15:54:47)
Posted by: Nitin Gupta
0%




var mmToMonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

function showLocalDate(timestamp)
{
  var dt = new Date(timestamp * 1000);
  var mm = mmToMonth[dt.getMonth()];
  return dt.getDate() "-" mm "-" dt.getFullYear() " " dt.getHours() ":" dt.getMinutes();
}

 

pass the unix timestamp to showLocalDate function  

 


Rate this blog

   Report Abuse


Comments


From gautam Patel at Wed Dec 24 2008 11:11:42 GMT 0530 (IST)

I have one htnl form in that one text box is given with date picker i select one date so in javascript how i can get unique time stamp i am not passing time just Enter the date so any one suggest me what to do for the making of javascript timestamp remember its not a current date here possible any of date and time formate.

-----------

Leave your comment(s) below:
To start Your own Blog




Other Blogs
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
2007 FruitNotes.com - All Rights Reserved.