datestr format in lower case
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
更多回答(2 个)
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);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!