Extract each data from a "date time" variable

good i want to extract
month in a variable
year in another variable
day in another variable

as you can see in the excel, the date data is marked in red

first I would have to take out those numbers of minutes and seconds

someone knows how this problem could be solved, I have many thanks

first create a datetime variable in loop you do date = Date.Parse(row(0).ToString)
date.Year
date.Month
…
to get the parts…

1 Like

HI
once after reading the data from excel with READ RANGE activity use FOR EACH ROW activity and pass the datatable variable as input
–inside the loop use a assign activity like this if the date format we get is like this
dd/MM/yyyy hh:mm:ss

str_date = Split(row(0).ToString.Substring(0,10),"/")(0).ToString
str_month = Split(row(0).ToString.Substring(0,10),"/")(1).ToString
str_year = Split(row(0).ToString.Substring(0,10),"/")(2).ToString

or if its like this
dd.MM.yyyy hh:mm:ss
then in assign activity lke this
str_date = Split(row(0).ToString.Substring(0,10),".")(0).ToString
str_month = Split(row(0).ToString.Substring(0,10),".")(1).ToString
str_year = Split(row(0).ToString.Substring(0,10),".")(2).ToString

Cheers @borismh

2 Likes

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