Change Date Format By USING swicth

Hello, I have a situation, where from the january to december, i need to change the format of date to number.

Currently in the system, I have the date in word like january, etc. I want to change january to 01. How to make it like that by using switch?

1 Like

yah its like this with simple assign activity
in_string = “January”
out_string = Datetime.Parseexact(in_string,“MMMM”,system.globalization.cultureinfo.invariantculture).ToString(“MM”)

where out_string is a string variable with value as 01

Cheers @f39b242a4f84ba555bd3

1 Like

Hi @f39b242a4f84ba555bd3

Cdate(row(“column name”).ToString (“MM/dd/yyyy”))


Try this if the dates you have are in this format @f39b242a4f84ba555bd3

Dim dt As String = “28-Jan-2019”

DateTime.ParseExact(dt, “dd-MMM-yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“dd-mm-yyyy”)

I’ve done it, but it still not changing it still in the jan. cheers

1 Like

Have you mentioned three M
like MMM
then only we will be getting as Jan
if we mention like MM we will be getting only the numerical form of month
Kindly check that once pls
Cheers @f39b242a4f84ba555bd3

Hi, Please see the attached screen if you are using Switch.



hello, can i see this simulation? Thanks!

You need to use the attached activity inside a Loop to change the Month value each time

MonthtoNumberSwitch.xaml (9.2 KB)


it still not change.
Think of another way, probably by using this
str_date = DateTime.ParseExact(“ChangeDateToAnewdateFormat”,“dd MMM yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”) but, i get an error.

1 Like

may i know what was the output of this if possible a screenshot pls
Cheers @f39b242a4f84ba555bd3

I cant screenshot bcs of some this page got problem. But I try to change it to by using assign activity

This is my workflow:

  1. Assign: ResultofDate = StrTheString.Substring( StrTheString.Length-6, 3)

  2. Then, i put in write line to see output

  3. Assign: NewDate =
    DateTime.ParseExact(ResultofDate, “dd-MMM-yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“dd-mm-yyyy”)

error: Assign:String was not recognized as a valid dateTime

1 Like

may i know what is the value of this variable StrTheString
i think we are missing with that substring method

Cheers @f39b242a4f84ba555bd3

The string actually, I got from the split string activity.

In the split string activity,got a list of dates in the input, and I split it, it only read the the day and month.

Results of this activity is : datatableDATE

then i use for each item in datatableDATE
assign to item.ToString

great then we need to change the parsing format
like this
DateTime.ParseExact(ResultofDate, “dMMMyyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“dd-mm-yyyy”)

its simple like what we have as format in input string ResultofDate should be mentioned next to it here in the highlighted area and here we have dMMMyyyy i.e., (2Aug2019)

DateTime.ParseExact(ResultofDate, “dMMMyyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“dd-mm-yyyy”)

Cheers @f39b242a4f84ba555bd3

image the same things happend. i’ll try to debug

1 Like

fine mention the date format here

of what mention here

you were almost done
kindly check once with that Substring
use a writeline and check what date format we are getting after using substring and mention that dateformat here

Cheers @f39b242a4f84ba555bd3

if you are free, can you provide me a simulation? thank you if u have a time.

input pls
Cheers @f39b242a4f84ba555bd3

here :
i use to split activity to get only get month and date
On Jun 28, 2019 @
On Aug 20, 2019 @
On Aug 19, 2019 @
On Jun 19, 2019 @
On Jun 26, 2019 @
On Jun 28, 2019 @

1 Like