필터 지우기
필터 지우기

How to add apostrophe as a text in a char of date?

조회 수: 2 (최근 30일)
Smithy
Smithy 2022년 8월 23일
댓글: Star Strider 2022년 8월 23일
Hello everybody,
I would like to create a character vector.
I tried below code.
DATE = '2019-05-31';
A2 = ['TO_DATE(',DATE,', ''YYYY-MM-DD'') '];
the answer is
A2 =
'TO_DATE(2019-05-31, 'YYYY-MM-DD') '
But I hope to make the answe as below. It has the apostrophe between date as '2019-05-31'.
'TO_DATE('2019-05-31', 'YYYY-MM-DD') '
Is there a way to do it?

채택된 답변

Star Strider
Star Strider 2022년 8월 23일
I am not certain what result you want.
Try this —
DATE = '2019-05-31';
A2 = ['TO_DATE(''',DATE,''', ''YYYY-MM-DD'') ']
A2 = 'TO_DATE('2019-05-31', 'YYYY-MM-DD') '
Note the doubled single apostrophes.
.
  댓글 수: 2
Smithy
Smithy 2022년 8월 23일
Wow... it works well. Thank you very much.
Star Strider
Star Strider 2022년 8월 23일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by