Error while converting value into date format

Hi
I’m trying to covert value into date format but getting an error can anyone help me on this?

@Akshaya89

Instead of parse use parseExact

cheers

2 Likes

Make the strSetDate as string variable. Expression looks correct

@Akshaya89

use below expression

DateTime.ParseExact("02/02/2025,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”) and output variable type should be string

@Akshaya89

If you want to convert the date from string to datetime format use this:
setDate(DateTime) = DateTime.ParseExact(“02/02/2025”, “MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture)
and output will be in datetime

1 Like

Hi @Akshaya89

Please use the below syntax, to resolve the error.

strSetDate = DateTime.ParseExact("02/02/2025","MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString()

Hope it helps!!

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