How to remove unwanted text in string

Hi,

I currently have this string, “07/12/2021 00:00:00”. How do I remove the 00:00:00

Thank you

Hi @Captainshame,

Try Below code:

String result = “07/12/2021 00:00:00”.Split(" "C);
Console.Writeline(Result(0));

Split.xaml (4.7 KB)

If it works, mark as a solution.
Regards,
Neelima.

Hi,

There are many ways to achieve it

For example…

text.Substring(0,10)

text.Remove(10,9)

System.Text.RegularExpressions.Regex.Match(text,"^\S+")

The following topic will help you.

Regards,

I recommend ToString Method like this.

DateTime.Parse(text).ToString(“MM/dd/yyyy”) <- Assing Activity
(you can change format that you want.)

@Captainshame

You can check below for your reference
Convert Date & Time Format Tutorial

Hope this helps you

Thanks

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