DikshaSK
(Diksha Sawant)
October 31, 2019, 8:10am
1
Hi All,
I have 2 variables with data type DateTime. D1 & D2
i have a third variable D3 which is a DateTime variable too.
I need the output somewhat like this
D3= D1 + D2
D1=12:00:12
D2= 00:00:10
output should be D3 : 12:00:32
Can someone please help me with this? I tried a bunch of options provided online but nothing is working for me.
lakshman
(Ganta lakshman)
October 31, 2019, 8:13am
2
@DikshaSK
Welcome back to the uipath community.
TimeSpan ts1 = TimeSpan.Parse(“12:00:12”)
TimeSpan ts2= TimeSpan.Parse(“00:00:10”)
TimeSpan tsSum = ts1 + ts2
Print tsSum
5 Likes
DikshaSK
(Diksha Sawant)
October 31, 2019, 8:22am
3
I need the data type to be DateTime.
as after this i have a if condition which im checking for this D3 > (other variable with Datetime.Now()) value
lakshman
(Ganta lakshman)
October 31, 2019, 8:27am
4
@DikshaSK
You can convert Timespan to Date time like below.
DateTime DT3 = Convert.ToDateTime(ts.ToString())
1 Like
DikshaSK
(Diksha Sawant)
October 31, 2019, 8:46am
5
Can you please tell me how to do reverse?
ie Datetime to Timespan instead
lakshman
(Ganta lakshman)
October 31, 2019, 8:51am
6
@DikshaSK
Timespan ts = DateTime.TimeOfDay
1 Like
system
(system)
Closed
November 3, 2019, 12:25pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.