How do I change the format of the date?

I want to display the current date.

todaysdate” variable is in datetime variable type. The expression I have used to get the current date is “now()”. Used “ToShortDateString” to get only the date.

I’m getting the date in “MM.dd.yyyy” format. How do I get in “dd.MM.yyyy” format ?

HI @uio

How about this expression

DateTime.ParseExact(StringInput.ToString,"MM.dd.yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Regards
Gokul

Hi @uio

Try with this

Now.ToString("dd.MM.yyyy")

image

Hi,

FYI, another approach:

We can use ModifyDate activity to output formatted date time string, as the following.

Regards,

Hai…

Try this

IMG_20221223_134554

Hi,

It worked. How do I achieve this by using just an expression ?

Hey @uio

You can try with the above expression

I want to assign this expression to a variable and it’s type is System.Datetime.

@sumitha_karthik @Gokul001

Hi,

DateTime variable cannot have format information.
Probably your workflow will be as the following.

Regards,

Hi @uio

Dateval = New DateTime(now.Year,now.Month,now.day)

Dateval | Variable type -> System.DateTime

CDate(Dateval ).ToString("dd.MM.yyyy")

Regards
Gokul

1 Like

Thanks a lot. It worked.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.