Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

UiPath-ADPv1 Exam - Topic 3 Question 60 Discussion

How do you subtract a specific TimeSpan from "Today" in VB.NET?
D) Today.Subtract(TimeSpan)
A) DateTime.SubtractSpanFrom(Today, TimeSpan)
B) DateTime.Now - TimeSpan
C) Today.SubtractUsingDate(-TimeSpan)

UiPath-ADPv1 Exam - Topic 3 Question 60 Discussion

Actual exam question for UiPath's UiPath-ADPv1 exam
Question #: 60
Topic #: 3
[All UiPath-ADPv1 Questions]

How do you subtract a specific TimeSpan from "Today" in VB.NET?

Show Suggested Answer Hide Answer
Suggested Answer: D

TheTodayproperty of theDateTimestructure returns the current date with the time component set to zero1.TheSubtractmethod of theDateTimestructure returns a newDateTimeobject that is the result of subtracting a specified time interval from this instance2.TheTimeSpanstructure represents a time interval that can be expressed in days, hours, minutes, seconds, and milliseconds3.

Option D is the correct way to subtract a specificTimeSpanfromTodayin VB.NET. For example, the following code snippet subtracts one day and two hours from the current date and displays the result:

Dim ts As New TimeSpan (1, 2, 0, 0) ' One day and two hours

Dim result As DateTime = Today.Subtract (ts) ' Subtract from Today

Console.WriteLine (result.ToString ('d')) ' Display the result

Option A is not valid, because there is noSubtractSpanFrommethod in theDateTimestructure. Option B is not correct, because it subtracts theTimeSpanfrom the current date and time, not just the date. Option C is not valid, because there is noSubtractUsingDatemethod in theDateTimestructure.


Contribute your Thoughts:

0/2000 characters
Cathrine
4 days ago
I thought "Subtract" was the method, but I can't recall if it works directly with "Today" or if it needs "Now".
upvoted 0 times
...
Janna
9 days ago
I remember practicing something similar, and I feel like using "Subtract" is the way to go, so maybe D?
upvoted 0 times
...
Charlene
14 days ago
I think it's option D, but I'm not entirely sure if "Today" is the right object to use.
upvoted 0 times
...

Save Cancel