gokul1904
(Glory 01)
August 26, 2022, 10:04am
1
Hello team,
I am getting received date from email using CurrentMail.Headers(“date”).ToString
I have a datetime in extracted into a string variable as “07/26/2022 02:37:38”
I want this to be extracted in 2 formats
07262022
07262022_023738
Can you please help me in converting into the upper 2 formats?
Regards,
Gokul
ppr
(Peter Preuss)
August 26, 2022, 10:10am
3
CDate(CurrentMail.Headers(“date”)).toString(“MMddyyyy”)
CDate(CurrentMail.Headers(“date”)).toString(“MMddyyyy_HHmmss”)
above similar to Varuns answer
With the Hint of:
Hi,
The recent Mail.Actvities package has issue of date in MailMessage.
If you use Mail.Activities package 1.11.4 or above, can you try to downgrade to 1.13.1-preview or 1.12.3, then try your expression or @ppr 's solution.
Regards,
1 Like
Hello @gokul1904
Try this
For 12 hrs format
DateTime.ParseExact("07/26/2022 02:37:38","MM/dd/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("MMddyyyy")
DateTime.ParseExact("07/26/2022 02:37:38","MM/dd/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("MMddyyyy_hhmmss")
For 24hrs Format
DateTime.ParseExact("07/26/2022 02:37:38","MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("MMddyyyy")
DateTime.ParseExact("07/26/2022 02:37:38","MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("MMddyyyy_HHmmss")
Veera_Raj
(Veeraraj Sethuraman)
August 26, 2022, 11:05am
5
DateTime.ParseExact(CurrentMail.Headers(“date”).ToString, “MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).tostring(“MMddyyyy_hhmmss”)
try this
system
(system)
Closed
August 29, 2022, 11:06am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.