%% 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')

% Copyright 2012 The MathWorks, Inc.