필터 지우기
필터 지우기

Date and Hour Vector extraction

조회 수: 1 (최근 30일)
hdiba
hdiba 2016년 4월 24일
답변: Arnab Sen 2016년 4월 29일
Hi everybody! I have a vector of doubles representing date and hour. Example
DateTime=[207199500
207199501
207199502
207199503
207199504
207199505...]
now i would like to convert it into a date vector and vector with hour values. Example for first entry: 20-07-1995 and 01:00. Can someone help? thanks
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 24일
What about 211199502? is it 21-01-1995 or 02-11-1995?
hdiba
hdiba 2016년 4월 24일
it is 02-11-1995(date) and 02:00 (hour). the month value is always 2 numbers. for january till september 01-09.

댓글을 달려면 로그인하십시오.

답변 (1개)

Arnab Sen
Arnab Sen 2016년 4월 29일
Hi hdiba,
For a sample datetime you can compute as following script. The same script should work for a Date Time vector as well.
>> dt=207199501
>> Time=mod(dt,100);
>> dt=floor(dt/100);
>> Year=mod(dt,10^4);
>>dt=floor(dt/10^4);
>>month=mod(dt,100);
>>day=floor(dt/100);

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by