from
current_date
by SamGhim
prints out current date and time.
|
| current_date
|
function [date time] = current_date
% current_date - neatly writes the current date and the time
% function calls :
% [DATE TIME] = CURRENT_DATE - provides both date and time
% CURRENT_DATE - provides only date
full_date = clock;
yr = num2str(full_date(1)); yr = yr(1:4);
mn = num2str(full_date(2)); mn = mn(1:2);
dt = num2str(full_date(3)); dt = dt(1:2);
hr = num2str(full_date(4));
if length(hr) == 1
hr = ['0' hr];
end
min = num2str(full_date(5));
if length(min) == 1
min = ['0' min];
end
sec = num2str(round(full_date(6)));
if length(sec) == 1
sec = ['0' sec];
end;
date = strcat(yr,'\',mn,'\',dt);
time = strcat(hr,':',mn,':',sec);
end
|
|
Contact us at files@mathworks.com