DateTime tryparse is returning false for 24 hour date format

Hi. I’m using invoke method activity in UiPath to verify a string. The command is :
BeginTimeIsProper = DateTime.TryParseExact(BeginTime,“yyyy-MM-ddThh:mm:ss.fffZ”,System.Globalization.CultureInfo.CurrentCulture,System.Globalization.DateTimeStyles.None,BeginTimeDate)

Following are the screenshots of activity, it’s properties:


Input parameters:

It’s failing to parse 24hr format time and it’s working for 12 hour format.

I tried with System.Globalization.CultureInfo.InvariantCulture also, but still it’s failing to parse 24hr format.

I need this format “yyyy-MM-ddThh:mm:ss.fffZ” DateTime to be send to UiPath orchestrator API requests. As an alternative, I tried to use DateTime.TryParse method from
Microsoft.OData.Edm namespace, but this namepsace is not available in my Studio. It’s not even showing in imports panel, when I’m trying to search there.

Can someone please help me to parse this date and time even if user is giving hours in 24hr format?

use HH instead of hh

1 Like

Ok. I’ll try

It’s working now. I struggled a lot to figure this out. Thank you @ppr

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