How to convert total time into hours

i want to convert total time of the employee into hours i m trying with “DateTime.ParseExact(strTotalTime,arstrFormats, New CultureInfo(“en”), DateTimeStyles.None).ToString(“H\h”)”

Analytics and AI(2) (4).xlsx (482.2 KB)

but still its not resolving
Main.xaml (17.4 KB)

Regards ,

Hi @Raina_Ocean_Sanjay

What is the issue that you are facing?

Try this

image

(DateTime.ParseExact(strTotalTime, arstrFormats, CultureInfo.InvariantCulture, DateTimeStyles.None)-Now.Date).TotalHours.ToString

Error ERROR Validation Error Compiler error(s) encountered processing expression “(DateTime.ParseExact(strTotalTime, arstrFormats, CultureInfo.InvariantCulture, DateTimeStyles.None)-Now.Date).TotalHours.ToString”.
‘CultureInfo’ is not declared. It may be inaccessible due to its protection level.
‘DateTimeStyles’ is not declared. It may be inaccessible due to its protection level. Main.xaml

Still this is showing me an error
Regards

Hi @Raina_Ocean_Sanjay

Please import System.Globalization into your project

image

1 Like

Hi @Raina_Ocean_Sanjay ,

You would need to import System.Globalization from Imports Panel
image

1 Like

Thank you !

My error is resolved

Regards ,
Ocean :slight_smile:

Thank you !
my error is resolved

Regards ,
Ocean:)

1 Like

Converts Total Time to hrs: String was not recognized as a valid DateTime.

before the process was running but now this is throwing me an error again

do u have an idea y this is showing the error now ?

regards

@Raina_Ocean_Sanjay

This error occurs because the string does not belong to any of this format

{"h\h m\m","m\m","h\h","<m\m","H\h m\m"}

now how sholud i resolve this ?

@Raina_Ocean_Sanjay

What is the string value (Total Time Per Day) where it is failing?

as described here:
:ambulance: :sos: [FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum

similar you can analyze and check within immediate panel your failling value

It is throwing me an error over 2 assign activity.

Regards ,

Thanks i will check this to!

Regards ,

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