datestr format in lower case

18 ビュー (過去 30 日間)
Natalia
Natalia 2011 年 4 月 19 日
Hello all, I want to express my serial date number in the form of 'ddd, mmm, yyyy', with ddd and mmm in lower case, but matlab is giving me back the date with the first letter of the day/month capitalized. How can I change it to lower case?

採用された回答

Arnaud Miege
Arnaud Miege 2011 年 4 月 19 日
Can you use the lower function to convert the string to lowercase?
HTH,
Arnaud

その他の回答 (2 件)

Jan
Jan 2011 年 4 月 19 日
lowerDate = lower(datestr(now, 'ddd, mmm, yyyy'))
Or much faster with manual conversion:
function Str = DateStrFormat(Num)
month = ['jan'; 'feb'; 'mar'; 'apr'; 'may'; 'jun'; ...
'jul'; 'aug'; 'sep'; 'oct'; 'nov'; 'dec'];
day = ['mon'; 'tue'; 'wed'; 'thu'; 'fri'; 'sat', 'sun'];
[y, m, d] = datevecmx(Num);
Str = sprintf('%s, %s, %.4d', ...
day(rem(floor(Num), 7) + 1), month(m), y);

Natalia
Natalia 2011 年 4 月 19 日
Thanks both.

カテゴリ

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