CSV into Excel - date and time fields need formatting

Yes, just wanted to check if the previous phase was right.
Alright then I have only an artisanal way to suggest: keep it with tt
So:

  • date_String=Datetime.ParseExact(row(“ASSIGNMENTFINISH”).ToString,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.CreateSpecificCulture(“el-GR”)).ToString(“dd/MM/yyyy HH:mm:ss tt”,System.Globalization.CultureInfo.CreateSpecificCulture(“el-GR”))
  • then use assign activity for date_string = date_string.Substring(0,date_string.Length-2) + “.” + date_string.Substring(date_string.Length-2,date_string.Length) to insert a point manually

Very smart workaround @Hiba_B!
The final correct is:
“date_string.Substring(0,date_string.Length-1) + “.” + date_string.Substring(date_string.Length-1,1)+”.“”.
Would you like to put it all together, so I can check it for solution?

Sure ! Great that it works :joy:

So to recap:

  • first read range the datatable (DT)
  • then use foreach row activity to loop in the DT
  • inside the foreach row, assign a string, let’s call it date_string, like that: date_string = row(“ASSIGNMENTFINISH”).toString
  • then put IF activity, and the condition would be:
    not date_string.contains(“μ”)
  • then create a DateTime in your variables, let’s say date_datetime, like that:
    image
  • use assign activity: date_time = Datetime.ParseExact(row(“ASSIGNMENTFINISH”).ToString,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.CreateSpecificCulture(“el-GR”))
  • use assign activity: date_string = date_time.toString(“dd/MM/yyyy HH:mm:ss tt”,System.Globalization.CultureInfo.CreateSpecificCulture(“el-GR”))
  • use assign activity: date_string = date_string.Substring(0,date_string.Length-1) + “.” + date_string.Substring(date_string.Length-1,1)+”."
  • use assign activity: row(“ASSIGNMENTFINISH”) = date_string
2 Likes

Thank you very much @Hiba_B and @NIVED_NAMBIAR for your help!
Very good work!

1 Like

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