www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ConvertDateandTimetoSpecificFormatExample.m
%% Convert Date and Time to Specific Format % Format the current date in the |mm/dd/yy| format. %% % You can specify this format using symbolic identifiers. formatOut = 'mm/dd/yy'; datestr(now,formatOut) %% % Alternatively, you can specify this format using a numeric identifier. formatOut = 2; datestr(now,formatOut) %% % You can reformat the date and time, and also show milliseconds. dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM')