Date Parse time

Hi everyone I need some help with this:
It this error with this date on the database


image
But with this date :
image
It does show the error

Hello @Anelisa_Bolosha1
how you are parsing the string.
provide like.
var_datetime= DateTime.ParseExact(“2023-10-01”,“yyyy-MM-dd”,Globalization.CultureInfo.InvariantCulture)

@Anelisa_Bolosha1

Can you please show what expression are you using?

and to check the format open the datatable in locals panel and check what is the difference…

cheers

HI @Anelisa_Bolosha1

Can you please share the expression you are using

May be you have multiple date formats , you can try with this one

DateTime.ParseExact(InputDate,{"yyyy-MM-dd","dd.MM.yyyy","MM/dd/yyyy hh:mm:ss","dd/MM/yyyy hh:mm:ss"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("Your Format")

Regards
Sudharsan

1 Like

Hi @Shubham_Kinge , like so,


e

hello @Anelisa_Bolosha1
Not like that provide like,
DateTime.ParseExact(inceptiondate,“yyyy-MM-dd”,Globalization.CultureInfo.InvariantCulture).tostring(“dd/MM/yyyy”)

if input is in - then - only if / then /

Try like this @Anelisa_Bolosha1

DateTime.ParseExact(InputDate,{"yyyy-MM-dd","dd.MM.yyyy","MM/dd/yyyy hh:mm:ss","dd/MM/yyyy hh:mm:ss","MM/dd/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("Your Format")

Regards
Sudharsan

1 Like

The input date is this:


‘commencementDate’ and it comes in this format: 2018-10-01, but I want to convert it to this format: dd/MM/YYYY

Hi @Anelisa_Bolosha1

Have you tried with this expression

DateTime.ParseExact(inceptiondate,"yyyy-MM-dd",Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

Regards
Gokul

1 Like

@Anelisa_Bolosha1

Try this

DateTime.ParseExact(inceptiondate,{"yyyy-MM-dd","dd.MM.yyyy","MM/dd/yyyy hh:mm:ss","dd/MM/yyyy hh:mm:ss","MM/dd/yyyy","dd/MM/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy")

Regards
Sudharsan

1 Like

Hi,

Simply can you try CDate as the following?

CDate(inceptiondate.Trim).ToString("dd/MM/YYYY")

Regards,

Thanks it worked fine now

1 Like

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