MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by huda nawaf
on 30 Mar 2013

*hi,

how convert this timestamp into real date?

ex.

1162160236000

datester, datenum do not work with it.

thanks in advance*

*No products are associated with this question.*

Answer by Walter Roberson
on 30 Mar 2013

29th instead of 27th? Sorry I cannot explain that one. If you had said 9 days after the 27th then I could have guessed that leap years were not being taken into account, but a difference of exactly 2 days does not make any sense to me.

The conversion I did was

TS = 1162160236000; datestr(datevec(TS/60/60/24/1000) + [1970 0 0 0 0 0])

The 1970 is in accordance with the Unix time convention of using time since the beginning of 1970.

If the difference had been 12 to 13 days, it could have represented an adjustment for the years ending in 00 not being leap years unless they were also divisible by 400. But 2 days off, I am at a loss for.

huda nawaf
on 31 Mar 2013

thanks,

can I used other way , the website of dataset give me other details about time , it give the real date , can I get integer from this information of time? I want get integer , then I can use datestr.

date_day \t date_month \t date_year \t date_hour \t date_minute \t date_second

29 10 2006 23 17 16

## 6 Comments

## per isakson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69175#comment_139963

Why do you believe this is a timestamp?

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69175#comment_139965

Is that a string or an integer? How does the number break down into hours, minutes, and seconds?

## huda nawaf (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69175#comment_140007

*I got this data from http://www.grouplens.org/node/462, it is about rating of movies.

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69175#comment_140009

Does that number represent 27-Oct-2006 22:17:16 ?

## huda nawaf (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69175#comment_140027

approximatly it is 29-Oct-2006 23:17:16 how get that? I need that function

thanks

## huda nawaf (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69175#comment_140029

*can get number from this long number(1162160236000) ,then I can user datestr

thanks*