I need to return todays date, as a DateTime object, then I want to subtract days from it to return the date from “in_days” Ago. So if someone wants a credit for one week, I want to credit them from 7 days ago up to todays date. I haven’t messed around with DateTime objects too much so any help is appreciated.
Also what are the differences/Best uses for System.DateTime and Microsoft.VisualBasics.DateAndTime?
Option Strict On disallows implicit conversions from String to double.
My in_CreditDays is a string coming in from the queue. I’m trying to convert it to a double.
I guess It doesn’t like how I’m doing it.
UPDATE:
So I assigned the in_CreditDays to a double, and used the exact same Double.parse Method and it worked.
I’m guessing the compiler was confused with the arguments I put in all at once.
I think it’s because you put a negative sign next to a String. You would want to place -1* next to the Double. Parse with no negative inside. So, it converts it to a double first, then multiplies it by -1
Note: if in_CreditDays is already a double type, then you don’t need to use Double.Parse() today.AddDays(-1*in_CreditDays) would be enough if it’s already a Double prior to that code.
Oh also, you should use an Integer for subtracting days. A Double type contains decimals.
Like for example, today.AddDays(-1.1) is the same as today.AddDays(-2), but different than today.AddDays(-1)
@HsDev - a datetime will always include both date and time. If you want to display as a string, you can change the format of it so it only shows the date by doing DateTime.Tostring(“MM/dd/yyyy”)
Okay, so I’m using set Text to enter the date ranges From and To date for the time OOS. the automation works… but it takes an abnormal amount of time… Like 20 seconds to enter the date into the field. Type into doesn’t work. It’s a field next to a little pop up calendar button that also services as a calculator. So when you enter the dates, it should update the ending credit total to match the days OOS. It just takes FooorEEEver