Convert DateTime to string and remove unwanted time?


I have a variable A=11/20/2018 00:00:00, type of it is DateTime

How to get a string as 20.11.18? Thanks

1 Like


Using you can place the format next to the .ToString
For example:


…assuming the variable is of a DateTime type, which if it is not, then you would need to convert it first.


1 Like



It Will Work Fine

1 Like

Hi @ClaytonM @Himanshu.joshi

both commands are not working with me. I shared the workflow and made an annotation where the conversion is required. Can you please check it?
Main.xaml (8.6 KB)

1 Like

It worked for me. See screenshot highlighted in yellow…


1 Like

Main (6).xaml (7.2 KB)

Here is The Workflow Which Works fine.

1 Like

That is really nice but I dont only want to display it using message box. I wanna save the Date 20.11.18 as string in variable. How? Because I keep becoming error while assigning it to a new string variable. Thanks

1 Like

The Varialbe i which you assign will be string type

String var=Convert.ToDateTime(CD).ToString(“dd.MM.yy”)


This is answer for your question


try various format, follow below link


1 Like

I used to extract just the date into string.

1 Like

It Worked for me fine , Thanks for the solution

1 Like

Hi @Kesavaraj_K
If this works for you please mark this as a solution. So this will be helpful for other community members as well

1 Like