Adding Days to DAte

LittleEddie

Member
Licensed User
Longtime User
DateTime
Date and time related methods.
DateTime is a predefined object. You should not declare it yourself.
Date and time values are stored as ticks. Ticks are the number of milliseconds since January 1, 1970.
This value is too large to be stored in an Int variable. It should only be stored in a Long variable.
The methods DateTime.Date and DateTime.Time convert the ticks value to a string.
You can get the current time with DateTime.Now.


Add (Ticks As Long, Years As Int, Months As Int, Days As Int) As Long
Returns a ticks value which is the result of adding the specified time spans to the given ticks value.
Pass negative values if you want to subtract the values.
Example:
Dim Tomorrow As Long
Tomorrow = DateTime.Add(DateTime.Now, 0, 0, 1)
Log("Tomorrow date is: " & DateTime.Date(Tomorrow))
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
Bonjour,

This code is OK only if the date is "Now". It does not go if it is an other date.

Exemple, i cannot do this:

Dim Dd As a DateDialog
Dim dateDG, DateTerme As Long
Dim TermeLbl As Label

dateDG = Dd.DateTicks
DateTerme = DateTime.Add(DateTime.date(dateDG), 0, 9, 0)
TermeLbl.Text = DateTime.Date(DateTerme)

Excuse my bad english, i'm french.

François
 
Upvote 0
Top