how convert 13 digits of timestamp?
Show older comments
*hi,
how convert 13 digits of timestamp like 1238536800000 into small number with 6 digits It is easy to deal with it.
THANKS *
7 Comments
Walter Roberson
on 5 Jul 2015
Please give us a sample timestamp and the exact time that it represents. Are the timestamps relative or absolute times? Are they possibly something like microseconds since a fixed time (as seen in MS Windows sometimes) ?
nada ali
on 5 Jul 2015
Azzi Abdelmalek
on 5 Jul 2015
You have the date. What is the problem?
Campion Loong
on 6 Jul 2015
Hi Nada,
If you have MATLAB 2014b or above, you can also use datetime to accomplish what you need. For example:
>> myDate = datetime(730851,'ConvertFrom','datenum')
myDate =
31-Dec-2000 00:00:00
Then you can conveniently extract various datetime components such as:
>> myYear = year(myDate)
myYear =
2000
nada ali
on 7 Jul 2015
@nada ali: what epoch and increment does that timestamp have? Without knowing what time system or encoding this timestamp uses, your question is impossible to answer.
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 5 Jul 2015
Edited: Azzi Abdelmalek
on 5 Jul 2015
use
format short
or
s=1238536800000
fprintf('%6.6g\n',s)
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!