mail.Headers(“Date”).toString => Fri, 9 Jun 2017 11:52:22 +0200 (CEST)
mail.xxxxxxxx(“xxxxxx”).toString => (only) 11:52:22
mail.Headers(“Date”).toString => Fri, 9 Jun 2017 11:52:22 +0200 (CEST)
mail.xxxxxxxx(“xxxxxx”).toString => (only) 11:52:22
You can try this: Convert.ToDateTime(mail.Headers(“Date”)).ToString(“hh:mm:ss”)
Regards…!!
Aksh
String was not recognized as a valid DateTime.
yes what you are using ? you are directly passing it on mail.Headers(“Date”)? it will return string so convert it into datetime then you can use this.
I guess by now this issue must be solved but if not you can try this format : “ddd, d MMM yyyy HH:mm:ss +0200 (CEST)” to convert it into datetime
dateVal = “Fri, 9 Jun 2017 11:52:22 +0200 (CEST)”
DateTime newDateValue = DateTime.ParseExact(dateVal,“ddd, d MMM yyyy HH:mm:ss +0200 (CEST)”,CultureInfo.InvariantCulture)
newDateValue.ToString(“dd.MM.yyyy”)