Format Unix timestamp (in milliseconds) to human readable

I have a unix timestamp that has been converted to milliseconds (example: 1438112220153)  and I need to convert it into a specific human readable format. The format I need to convert to is as follows:


Can someone show me how to accomplish this task?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:

Does this help?

[ ]

<script language="javascript">
var datValue = new Date(1438112220153).toISOString();


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
<script type="text/javascript">
function myDate( date1 ) {
  //Get 1 day in milliseconds
  var one_day=1000*60*60*24;

  // Convert date to milliseconds
  var date1_ms = date1.getTime();

  //take out milliseconds
  var millisecs =date1.getMilliseconds();
  if( millisecs < 10 ) millisecs = '00'+millisecs;
  else if( millisecs < 100 ) millisecs = '0'+millisecs;
  date1_ms = date1_ms/1000;

  var seconds = Math.floor(date1_ms % 60);
  seconds = (seconds<10?'0':'')+seconds;
  date1_ms = date1_ms/60; 

  var minutes = Math.floor(date1_ms % 60);
  minutes = (minutes<10?'0':'')+minutes;
  date1_ms = date1_ms/60; 
  var hours = Math.floor(date1_ms % 24);
  hours = (hours<10?'0':'')+hours;  
  //var days = Math.floor(date1_ms/24);
  //return days + ' days, ' + hours + ' hours, ' + minutes + ' minutes, and ' + seconds + ' seconds';
  return hours + ':' + minutes + ':' + seconds + '.' + millisecs;

var d = new Date(1438112220153);
alert( myDate( d ) );

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.