Home > matutils > dateconv > date2tstr.m

date2tstr

PURPOSE ^

function str=date2tstr(time)

SYNOPSIS ^

function str=date2tstr(time)

DESCRIPTION ^

 function str=date2tstr(time)

 takes time structure, output of tstr2date, and convert it back to
 string format

 Michael Loh

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function str=date2tstr(time)
0002 
0003 % function str=date2tstr(time)
0004 %
0005 % takes time structure, output of tstr2date, and convert it back to
0006 % string format
0007 %
0008 % Michael Loh
0009 
0010 c{1}=num2str(time.day);
0011 if time.day<10
0012   c{1}=['0',c{1}];
0013 end
0014 c{2}='-';
0015 c{3}=time.month;
0016 c{4}='-';
0017 c{5}=num2str(time.year);
0018 c{6}=':';
0019 c{7}=num2str(time.hour);
0020 if time.hour<10
0021   c{7}=['0',c{7}];
0022 end
0023 c{8}=':';
0024 c{9}=num2str(time.min);
0025 if time.min<10
0026   c{9}=['0',c{9}];
0027 end
0028 c{10}=':';
0029 c{11}=num2str(time.sec);
0030 if time.sec<10
0031   c{11}=['0',c{11}];
0032 end
0033 
0034 str=[];
0035 for i=1:length(c)
0036   str=[str c{i}];
0037 end
0038

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005