UTC Timezone to IST Timezone datetime

Hello,

I have a data table which contains a column in datetime(UTC Timezone) data type. I want to convert this datetime data column to IST timezone DateTime. I don’t want to use loop to do this conversion. because huge number of rows need to be processed which will take more time. I want to do this conversion for a whole column without using loop. Please can anyone tell me how to do that.

Basically want to convert a data column date time to IST timezone data time.
Thanks!

Hi @Gopi_Arumugam ,

The steps to achieve is as follows:
1.Declare a variable of type Time Zone Info (TZI)
2.Add an assign activity to set IST as Time Zone Info
i.e. TZI = TimeZoneInfo.FindSystemTimeZoneById(“India Standard Time”)
3.Use Invoke code activity and Pass your data table as argument
Inside invoke code have the below code written
datatable.AsEnumerable.ToList.ForEach(Sub(x) X(“DateColumn”) = TimeZoneInfo.ConvertTimeFromUtc(X(“DateColumn”).ToString, TZI ) )

Hi @shivagowdavarad ,

Thanks a lot for your response.

If am using .tostring method it throws an compile time error where it allows only date time type.

datatable.AsEnumerable.ToList.ForEach(Sub(x) X(“DateColumn”) = TimeZoneInfo.ConvertTimeFromUtc(X(“DateColumn”).ToString**, TZI ) )**

I am using this code in invoke code activitt dtSample.AsEnumerable.ToList.ForEach(Sub(x) X(“doj”) = TimeZoneInfo.ConvertTimeFromUtc(convert.ToDateTime(X(“doj”)),TimeZoneInfo.FindSystemTimeZoneById(“India Standard Time”))).

And passing an data table in argument as dtSample. Still i am getting the error ->>> Invoke code: Exception has been thrown by the target of an invocation.

What could be the issue?

Regards,
Gopi A

Use tryParseExact, i guess there might be some blank rows or improper date time.

Hello @shivagowdavarad ,

Sorry for the delay in response. Will check and update here. Thanks for your response.

Hi @shivagowdavarad ,

Sorry for the delay. I don’t know where i am missing it. Could you please explain how to use tryParseExact here to avoid blank values.