How to change date format?

Hi there,

I’m trying to change a date in the format of ‘06-03-2020’ (i.e. mm/dd/yyyy) to ‘03 June 2020’. How would I do this?

Thanks in advance.

dateString= ‘06-03-2020’

FormattedDateString=cdate(dateString).tostring(“dd MMM yyyy”)

i assume your date variable is a type of string

‘06-03-2020’ is a datetime variable.

@Mya_Onyett

Check as below
Convert Date & Time Format Tutorial

Hope this helps you

Thanks

FormattedDateString=dateString.tostring(“dd MMM yyyy”)

Hello Mya,
In this video I do a lot of stuff with DateTime:
For you should convert your string to DateTime and then display DateTime.ToLongDateString

20:05 DateTime to string in multiple ways
23:00 AddDays get DayofWeek
25:40 Convert from String to DateTime
26:20 Compare DateTime

Thanks,
Cristian Negulescu

1 Like

assign this to a new string variable:
DateTime.ParseExact("06-03-2020", "MM-dd-yyyy",Nothing).ToString("dd MMM yyyy")

image

  1. DateTime.ParseExact("06-03-2020", "MM-dd-yyyy",Nothing) means you convert 06-03-2020 to a dateTime variable, and tell it 06 means month, 03 means day, 2020 means year

  2. toString(“dd MMM yyyy”) means you convert the above date to dd MMM yyyy format