Convert DateTime to string and remove unwanted time?

Hey,

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

Hi.

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

variable.ToString("dd.MM.yy")

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

Regards.

Use

Convert.ToDateTime(A).ToString(“dd.MM.yy”)

It Will Work Fine

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)

It worked for me. See screenshot highlighted in yellow…

Thanks.

Main (6).xaml (7.2 KB)

Here is The Workflow Which Works fine.

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

The Varialbe i which you assign will be string type

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

Hi
This is answer for your question

A.ToString(“dd.MM.yy”)

try various format, follow below link

Thanks

I used a.date.toshortdatestring() to extract just the date into string.

It Worked for me fine , Thanks for the solution

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