Excel stores values under this format MM/dd/yyyy HH:mm:ss, but i need to use a variable which represents cell in Excell and the desired format should be “dd.mm.yyyy”.
FIrst,I tried using regular expression and get only the date (without HH:mm:ss) and having this match i convert it to string.Now I’m looking for ideas to have this string repsented in this way “dd.mm.yyyy”.
I can not use DateTime.Parse exact, or convert it to date due to compiler.
I tried converting string to int32 using Cint in order to utilize mentioned methods, but alas it doesn’t work.
Fine
hope this expression would help you
if we are iterating through excel with read range activity and using a for each row loop then
inside the loop use a assign activity like this str_datevalue = Datetime.ParseExact(row(“yourcolumnname”).ToString.SubString(0,10),“MM/dd/yyyy”,system.globalization.CultureInfo.InvariantCulture).ToString(“dd.MM.yyyy”)
now the string variable str_datevalue output would be in format dd.MM.yyyy
usually when a datetime is read in excel it will give us output in a string of format
dd/MM/yyyy hh:mm:ss
so to take the first 10 characters alone in that string
used .SubString(0,10)
where 0 is the index position from where to start denoting the first position
and 10 represents the number of characters to be obtained which would give us dd/MM/yyyy