Hi Everyone,
I am trying to convert a date 20230919 to the desired format
MM/yyyy/dd
Appreciate if helped with a syntax
Hi Everyone,
I am trying to convert a date 20230919 to the desired format
MM/yyyy/dd
Appreciate if helped with a syntax
Hi @Tanu_G
Check this out
Datetimevar= DateTime.ParseExact(“20230919”,“yyyyMMdd”,System.Globalization.CultureInfo.InvariantCulture). ToString(“MM/yyyy/dd”)
Hope this helps
if you might have different input date formats, I recommend always using parse exact, but providing various date patterns in an input array.
var_datetime = DateTime.ParseExact(Strinput.ToString, arr_formats, System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None)
arr_formats = {“yyyyMMdd”, “MM/dd/yyyy”, “dd/yy”}
I hope it helped you
Thanks @andreus91 this looks cool too!
But current requirement is only for the above format
But definitely I will be needing this in future
Thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.