Date conversion from excel column

hello guys,
i am using row.item(“column name”) but my column contain date type.
declared variable as datatime but it showing error while putting tostring
pls refer below image and correct me.

1 Like

Hi @prashantP

Use row.item(“StringValue”)=CDate(row(“StringValue”).ToString

Thanks
Ashwin S

Use in the assign activity as

val = datetime.parse(row(“string value”).tostring, “format you are getting from excel”, System.Globalization.CultureInfo.InvariantCulture).tostring(“format you want”)

Hello @AshwinS2
thank you for fast response.
as you said i did this variable type change as a string…check below img

after runing process value is typing with time. pls check below img…
image

and having date values in “stingvalue” is in below img…
image

Hi @prashantP
Use Convert.ToDateTime(row(“StingValue”).ToString)

or DateTime.ParseExtract(row(“StringValue”).ToString,“dd/mm/yyyy”,System.Globalization.CultureInfo.InvariantCultrue).ToString(“dd/MM/yyyy hh:mm:ss”)

Thanks
Ashwin S

hi @HareeshMR
thank you…
but still getting error pls correct me if i miss something ?

Place the cursor on the error so that it will show what is the error in the entire string @prashantP

One thing is, change datetime.parse to DateTime.ParseExact @Assetsoft… that will work

using exact

@prashantP Try below solution

assign str = row(“ur column name”).ToString
assign str = cDate(str).ToString(“dd/MM/yyyy”)

hello @indra
pls correct me

hi @prashantP

Use val1=CDate(val).ToString(“MM/dd/yyyy hh:mm:ss”)

Thanks
Ashwin S

1 Like

thanks @AshwinS2 @indra @HareeshMR
i don’t need time so i removed it
image

@prashantP In the assign activity remove str and pass val

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