I'm trying to format the following value 01/08/2020
Dim value1 as string = '01/08/2020'
Response.Write(Format(CDate(value1),"yyyy-MMM-dd"))
The result returned as 2020-Jan-08 instead of 2020-Aug-01
There is an easier method for formatting dates. Try this:
Response.Write(DateTime.ParseExact(value1, "dd/MM/yyyy", null).ToString("yyyy-MMM-dd"))
See https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings for the various possible date formats.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments