datetime.ParseExact(OutputTextSQL,“MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM yyyy”)
i read date from sql and want to use select date dynamically, and im put date from sql to output datatable string, so when im convert to datetime still erorr. please help me
strMonthYear is string. OutputTextSQL is String from value Ouput DataTable
Yoichi
(Yoichi)
November 15, 2022, 2:22am
2
Hi,
For now, can you try to add Trim as the following?
datetime.ParseExact(OutputTextSQL.Trim(),"MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MMMM yyyy")
If the above doesn’t work, can you share error message and content of OutputTextSQL in LocalsPanel?
Regards,
Hi Yoichi,
Still get the erorr sir.
Yoichi
(Yoichi)
November 15, 2022, 2:28am
4
Hi,
How about the following expression?
datetime.ParseExact(System.Text.RegularExpressions.Regex.Match(OutputTextSQL,"\b\d{2}/\d{2}/\d{4}\b").Value,"MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MMMM yyyy")
Regards,
Got it, Thanks you Yoichi.
1 Like
system
(system)
Closed
November 18, 2022, 2:33am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.