How can I add a day on a datestr equation?

조회 수: 3 (최근 30일)
jjlivestrong
jjlivestrong 2012년 9월 27일
I am having trouble understanding the serial number concept of date commands.
I want to sum five days on the command datestr(now)
I am proceding the following way
x = datestr(now,1)
ans =
27-Sep-2012
I want to add up five days (y = 7 days) so that x + y =
2-Oct-2012
Can you please help?

채택된 답변

Star Strider
Star Strider 2012년 9월 27일
편집: Star Strider 2012년 9월 27일
Another option is addtodate.
For example:
x = datestr(now,1)
y = 5;
z = addtodate(datenum(x), y, 'day');
zs = datestr(z,1)
gives:
x =
27-Sep-2012
zs =
02-Oct-2012

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Functions에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by