Date and Datestr

9 ビュー (過去 30 日間)
Natan Katz
Natan Katz 2011 年 8 月 3 日
Hello
1. I have noticed that datestr provides the following '31-jul-0111". Is there an alternative function that provides date format (e.g. '31-jul-2011')
2. The values of matlab differ from excel numerically hence datestr(40752)='29-jul-0111' rather 28th, and weekd(date) and weekday(40758) are not similar how can it be settled.
Thanks ahaead

回答 (2 件)

Andreas Goser
Andreas Goser 2011 年 8 月 3 日
I'd say the reason for different results is described here

Jan
Jan 2011 年 8 月 3 日
Matlab and Excel use different serial date formats. In addition Excel itself uses different format under Windows and MacOS. The serial date nbumbers start at:
* MATLAB: 0 January 0000
* Excel PC: 01 January 1900
* Excel Mac: 01 January 1904
The conversion is straight (here for PC-Excel):
Matlab_datenum = Excel_datenum + datenum('01-Jan-1900')
The function FinanceToolbox: m2xdate can convert these formats - I assume without the Mac-trick.

カテゴリ

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