How to convert date format from 31-March-2019 to Sunday, March 31,2019

How to convert date format from 31-March-2019 to Sunday, March 31,2019

You can use the DateTime.ToString(format)

example:

Date = 31-March-2019
Date.ToString(“dddd, MMMM dd,yyyy”)

2 Likes

Hi,
You can use
dateValue.DayOfWeek(), which will give you a number of day in week
Or
dateValue.ToString(“dddd”), which will return name of the day

And after this, I will probably split dateValue to String array using assign activity
arrayDateValue = dateValue.ToString().Split(“-”)
and “manually” join elements in array together:

dateValue.ToString(“dddd”), arrayDateValue(1) + “,” + arrayDateValue(0) + “,” + arrayDateValue(2)

Another option could be to search for dateTime formats, maybe you will be able to write everything to one ToString() with parametr.
Check this: Custom date and time format strings | Microsoft Learn

@learie

Try below expression:

Datetime.parseexact(“31-March-2019”,“dd-MMMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture).tostring(“dddd,MMMM dd,yyyy”)

5 Likes

Dear @learie,

use System.DateTime.Now.DayOfWeek to fetch todays day
and to get the specific format of the date we can use datetime variable to store the date
datetime variable valend = system.datetime.now.tostring(“MMMM dd,yyyy”)
to extract the day from a specifc date
Assign to datetime variable
DateTime dateValue = 31-March-2019(it will automatically recreate to date format of yyyy-MM-dd)
Writeline - dateValue.DayOfWeek.tostring +“,”+dateValue.tostring(“MMMM dd,yyyy”)

Regards
Srish

1 Like

Thank you very much…

Thank you very much…Well… this was throwing an error but I have found something else that solved the issue.

1 Like

@learie

What error it was throwed when you tried it ?