Hi Team,
I have the below format i need the only the date and time 2019/09/13 13:34:55
I tried but not getting the proper value. Please help me out
receivedate: 2019/09/13 13:34:55
Thanks,
Sneha
Hi Team,
I have the below format i need the only the date and time 2019/09/13 13:34:55
I tried but not getting the proper value. Please help me out
receivedate: 2019/09/13 13:34:55
Thanks,
Sneha
Hi @Snehamayi
Try to format your string kindlly follow this link for your reference.
cheers
Happy learning
Hi,
Thanks for your response.
No actually my requirement is I am getting the proper date and time .
I am extracting the date by using Get Text activity but I don’t want the text value I want to substring and split to get the value after “:”
i.e 2019/09/13 13:34:55
receivedate: 2019/09/13 13:34:55
Thanks,
Sneha
Thanks…
Yes only the date and time.
Could you please paste your input data from where you want to read Date and Time. So that we can help you how to do that.
Ya I am extracting from my mail by using Get Text activity receivedate: 2019/09/13 13:34:55
Here I need to store only the date n time not the text receivedate only the date n time.
Thanks.
Hi @Snehamayi
Use YourRecivedString.Split(cChar(":"))(1)(2)(3)(4)
. Or use YourRecivedString.Split(cChar(" "))(1)(2)
.
Okk…Thanks…Let em try…
Try below one:
yourStr = “receivedate: 2019/09/13 13:34:55”
yourStr.substring(yourStr.IndexOf("receivedate: ")+"receivedate: ".Length)
No I tried with both it doesnot give me result.
YourRecivedString.Split(cChar(“:”))(1)(2)(3)(4) -->this showing Error
@Snehamayi Try this
Assign str = "receivedate: 2019/09/13 13:34:55"
Assign str_date = str.Split(" ".ToCharArray)(1).ToString
Assign str_time = str.Split(" ".ToCharArray)(2).ToString
Hi @Snehamayi
Use this if your desired output is : 2019/09/13 13:34:55
str.Split(" “c)(1).ToString + " " +str.Split(” "c)(2).ToString
If you want date use str.Split(" “c)(1).ToString and time use str.Split(” "c)(2).ToString
You’ll want to convert it to a real date variable using DateParse.Exact.
It will look something like this:
DateTime.ParseExact(receivedate, "yyyy/MM/dd hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture)
Then once you have a real date you can convert it into any string format you want like this for just date:
yourDate.ToString(“dd/MM/yy”)
which would output “13/09/19”
and this for just time:
yourDate.ToString(“hh:mm”)
which would output 13:34
You may have to play around with different Date Formats to get the one that’s right for you