String datetime format

hi i want to change my string variabel into another format but i dont want to make it a datetime variable

ex: string input: “22/12/2021”
string output :“22.12.2021”
any solution?

thanks

1 Like

Use replace method
Try out this syntax
Output_String=Your_stringvariale.Replace("/",".")

Thanks,
Robin S

2 Likes

Hi @Ahmad_Rais

Try this below expression

DateTime.ParseExact(“22/12/2021”,(“dd/MM/yyyy”),Globalization.CultureInfo.InvariantCulture).ToString(“dd.MM.yyyy”)

Refer this Link for More Info

Regards
Gokul

1 Like

@Ahmad_Rais

Check below for your reference

Reference

Hope this will help you

Thanks

is this for input string type or datetime? , i was looking for both input and output string type

Both output & Input will be in String Format @Ahmad_Rais

Regards
Gokul

Just use replace method

i have tried but somehow it still says error
image
but if i make new file it works maybe i miss something

Can you share the Input and screenshot. What you are used here?

@Ahmad_Rais

Hi

It might be because of extra space at last

Hope this expression would help you resolve this

Use a assign activity like this

Stroutput = Datetime.ParseExact(Strinput.ToString.Trim.SubString(0,10), “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd.MM.yyyy”)

Here both Strinput and stroutput both are string variables

Cheers @Ahmad_Rais

1 Like

yup , its because of the whitespace the trim done the trick

1 Like

hi thanks for the suggestion , the trim done the trick

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