フィルターのクリア

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 Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by