Hello guys i have an excel having a date column i need to get year from the column
This is the code i have
This is the error iam getting
Is there any solution for this
Hello guys i have an excel having a date column i need to get year from the column
This is the code i have
This is the error iam getting
Is there any solution for this
DateTime.ParseExact(Policydate,"dd-MM-yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy")
Regards
Use this -
DateTime.ParseExact(row("POLICY FROM").ToString(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy")
Thanks,
Ashok
Please check if any empty data is being extracted and stored in that variable.
Regards
Can you share the excel? @Gokul_Murali
Regards
As mentioned there:
the firstAid
Kindly note: an empty string cannot be converted into a datetime. In such cases we do:
Premium Registers - 11.06.2024.xlsx (11.9 KB)
Try with the below syntax. I have checked and it’s working fine
CurrentRow("MOC") = DateTime.ParseExact(CurrentRow("POLICY FROM").ToString.Split(" "c).First,"MM/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy")
Regards
Bro still iam getting the same error
And the excel i shared is a sample excel the original excel is containing artound 18000 rows
Please check the properties panel of all the activities and please change the seeting in the same way. No matter how many rows the code will work fine !! @Gokul_Murali
regards
Your error indicates that one of your Policydate is empty.
You could add a check before converting it with CDate().
PolicyYear = If (String.IsNullOrWhiteSpace(Policydate), "", CDate(Policydate).ToString("yyyy"))
Please check the below xaml I haved used the invoke code and linq query please check and update me the result:
Sequence9 1.xaml (10.0 KB)
Regards
Excel_Date_Conv.xaml (7.6 KB)
Hi refer the attached xaml this may solve the issue.
Solution:
Inside this xaml, Replaced the (-) to (/) in the date for eg: changed the date from 20-06-2024 to 20/06/2024.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.