How to save values as date time in For each row in datatable?

Hi Everyone,

I am trying to save a value to a datetime variable.

can someone guide me accordingly?

As you can see I tried using the Current.item(“Created On”).ToString

however, it seems this method is only working when I am dealing with string variable.

My goal is to save it to a datetime variable.

Can someone guide me?

Thanks!

Hi @alvin.c.apostol26
If the data type of the variable is of date type.
Convert into the string datatype(Createdon)

@alvin.c.apostol26 you left side variable is datetime and you tries to assign it as a string.
Convert it as a type of string

CurrentRow(YourColNameOrIndex) will return an object
when CreatedOn Variable is of DataType: DateTime then the column value has to be of a DateTime or needs to be converted into a datetime

@alvin.c.apostol26

Assign activity:
DateTime dateVariable = DateTime.Parse("2023-07-26")

OR

Assign activity:
DateTime dateVariable = DateTime.ParseExact("26-07-2023", "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)

Hope it works!!

Hi @alvin.c.apostol26

Try this

out_date = Datetime.ParseExact(“12/05/2019”,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)

or

out_date = Datetime.ParseExact(YourDateVar,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
I hope it helps!!

Hi @alvin.c.apostol26 ,
You need convert data type
Regards,
LNV