BNK
(nirmal)
October 5, 2021, 4:57am
1
Bot read mail received date . I received the below data format
Mon, 13 Sep 2021 09:39:25 +0000
I need to convert the above date format to 13-Sep-2021 09:39 (like this)
I tried with below code
Convert.ToDateTime(Receiveddate).Date.ToString(“dd-MMM-yyyy hh:mm”)
But time is not coming properly.
Yoichi
(Yoichi)
October 5, 2021, 5:04am
2
Hi,
Can you try the following expression?
Convert.ToDateTime(Receiveddate).ToString("dd-MMM-yyyy HH:mm")
Regards,
BNK
(nirmal)
October 5, 2021, 5:11am
3
I received below output
13-Sep-2021 00:00
Time is not coming properely
Gokul001
(Gokul Balaji)
October 5, 2021, 5:13am
4
Hi @BNK
Try to use this expression
DateTime.ParseExact(Split(ReceivedDate,"+")(0).TrimEnd,"ddd, dd MMM yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy HH:mm")
Regards
Gokul
1 Like
Yoichi
(Yoichi)
October 5, 2021, 5:16am
5
Hi,
in my environment, it works and return date time considered TimeZone.
For now, can you try the following? (without variable)
Convert.ToDateTime("Mon, 13 Sep 2021 09:39:25 +0000").ToString("dd-MMM-yyyy HH:mm")
Regards,
Charbel1
(Charbel)
October 5, 2021, 5:20am
6
BNK:
13-Sep-2021 00:00
The “+0000” may be provoking the problem, we can avoid it by doing this:
Convert.ToDateTime(Receiveddate.Substring(0,Receiveddate.IndexOf("+"c))).ToString("dd-MMM-yyyy HH:mm")
Best,
Charbel
BNK
(nirmal)
October 5, 2021, 5:41am
7
@Yoichi @Gokul001 @Charbel1
How to read the mail received date.
I Use below code
But i received below output
Mon, 13 Sep 2021 09:39:25 +0000
AM or PM not coming properly.
Charbel1
(Charbel)
October 5, 2021, 5:43am
8
PM should show 21:39:25, isn’t it?
BNK
(nirmal)
October 5, 2021, 5:46am
9
Original mail receive date
But i am receiving below output
Mon, 13 Sep 2021 09:39:25 +0000
Time is not coming properely
Yoichi
(Yoichi)
October 5, 2021, 5:52am
10
Hi,
Can you try the following?
Convert.ToDateTime("Mon, 13 Sep 2021 09:39:25 +0000").ToString("dd-MMM-yyyy hh:mm tt K")
Regards,
Gokul001
(Gokul Balaji)
October 5, 2021, 5:55am
11
Hi @BNK
Try to use the below expression
DateTime.ParseExact(Split(di,"+")(0).TrimEnd,"ddd, dd MMM yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy HH:mm tt")
Refer the link For Date Format:
Regards
Gokul
1 Like
BNK
(nirmal)
October 5, 2021, 6:03am
12
It is working. but while get the date from mail is not working correctly.
Yoichi
(Yoichi)
October 5, 2021, 6:06am
13
Hi,
Can you share content of Receiveddate variable? And your first expression has extra Date method. So you need to remove it.
Regards,
BNK
(nirmal)
October 5, 2021, 6:08am
14
Below code i used for get received date from mail
Yoichi
(Yoichi)
October 5, 2021, 6:10am
15
Hi,
Can you share its content using LogMessage, WriteLine or Messagebox?
And can you also show us your expression to convert it?
Regards,
BNK
(nirmal)
October 5, 2021, 6:19am
16
I received below data as output for Received date
Mon, 13 Sep 2021 09:38:55 +0000
Yoichi
(Yoichi)
October 5, 2021, 6:22am
17
Hi,
Thank you for sharing. Doesn’t the following expression work correctly? Can you share its result and expression?
Convert.ToDateTime(Receiveddate).ToString("dd-MMM-yyyy hh:mm tt K")
Regards,
BNK
(nirmal)
October 5, 2021, 6:25am
18
Above expression is working fine. but while get receive date from mail it is not working properly.
Yoichi
(Yoichi)
October 5, 2021, 6:33am
19
Hi,
Can you put the following activities, then share screenshot of output panel?
Or if you have any error, please share it.
Regards,