Convert string to datetime error

Hey, I am trying to get the time with get text activity and it looks like this 6:27 AM
how do I convert it to datetime or how can I check the difference between this time and local time

Hi @zhasmina.dimitrova

Use like this


Now.Subtract(Datetime.ParseExact("6:27 AM","h:m tt",System.Globalization.CultureInfo.InvariantCulture))

To get hours use .TotalHours

Similarly .ToMinutes, .ToSeconds etc

cheers

HI @zhasmina.dimitrova

Check out this XAML file

DifferentTime.xaml (5.3 KB)

image

image

Regards
Gokul

Hi,

FYI, another approach:

image

(CDate(Now.ToString("yyyy/MM/dd ")+yourString.Trim)-Now).ToString

Regards,

2 Likes

Thank you, @Yoichi , it worked!

1 Like

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