i have 2 questions:
- in following matlab code
x
date time value of format "datetime(y,m,d,h,mi,s,ms)".display(x)
command displays '00:00:00'. 'if condition' displays 'well received!' means real value of x greater 0 opposed '00:00:00' displayed display(x) command. please suggest how display full value ofx
milliseconds or microseconds. - how can save '0000,00,00,00,00,00,200' date time value?
send = datetime(2016,08,31,06,01,00,00); receive=datetime(2016,08,31,06,01,00,100); x=receive-send; display(x); if (x>0) disp('well received!') else disp('late!') end
the variable x
created in example duration
object. can specify display of milliseconds (as smaller decimal fractions of seconds) setting format
property.
>> x.format = 'hh:mm:ss.sss'; >> display(x); x = 00:00:00.100
this presumably want when ask saving '0000,00,00,00,00,00,200' date time value. it's not date , time duration, , can created using duration
constructor.
>> duration(00,00,00,200,'format','hh:mm:ss.sss') ans = 00:00:00.200
most operations acting on these duration
objects work expected, such comparison >
operator:
>> x > duration(00,00,00,200) ans = 0
Comments
Post a Comment