フィルターのクリア

Transformation of Date

2 ビュー (過去 30 日間)
Mtlb Usr
Mtlb Usr 2011 年 2 月 24 日
Hi,
I have a issue with several dates that I receive from a macro with numeric format. Then, When I want to transform to string format in matlab, the date doesn't keep the original format.
For example:
12/03/11 05:04:30 --> num --> datestr(num,'dd-mm-yy HH:MM:SS')--> 13/03/0111 05:04:30
How can I revolve this issue?
thanks
regards

採用された回答

Mtlb Usr
Mtlb Usr 2011 年 2 月 24 日
Hi,
Sorry I have confused. The issue is that the number that I get from a macro is in the 1900/01/01 base of date. However, in matlab the base of date is 0000/01/01.
I have to check this difference for resolve the issue.
regards.
  2 件のコメント
Andreas Goser
Andreas Goser 2011 年 2 月 24 日
When you "macro" - that is somethin in MS Excel?
Mtlb Usr
Mtlb Usr 2011 年 2 月 24 日
Hi,
Yes, that is.
regards

サインインしてコメントする。

その他の回答 (2 件)

Jan
Jan 2011 年 2 月 24 日
Extremely strange. Please edit your question and insert the original code you used for this and mention the Matlab version.
In Matlab 2009a I get:
S = '12/03/11 05:04:30'
num = datenum(S)
datestr(num, 'dd-mm-yy HH:MM:SS')
>> '03-12-11 05:04:30'
The result is as expected. The result you get '13/03/0111 05:04:30' is surprising: where do the '/' come from?!

Andreas Goser
Andreas Goser 2011 年 2 月 24 日
  1 件のコメント
Mtlb Usr
Mtlb Usr 2011 年 2 月 24 日
Hi Andreas,
You are right.
I have resolved with a similar solution.
thanks
regards

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by