Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on April 08, 2022, 05:35:32 am



Title: Ask Reuben 120 - Datetime Addition
Post by: Reuben B. on April 08, 2022, 05:35:32 am
With DATETIME variables, a common requirement is to add a number of minutes to a DATETIME.
 
Developers occasionally get stuck and the reason I believe is that Implicit Type conversions occasionally get you into bad habits.  Sometimes you need to take a step back, use 3 lines of code instead of 1, then you can see the issue, and then see what the 1 line of code solution is.
 
With DATETIME addition, that can mean making sure that what you are attempting to add to the DATETIME is an INTERVAL, not a STRING.  It should be DATETIME + INTERVAL = DATETIME
 
Read more here https://4js.com/ask-reuben/ig-120/


Title: Re: Ask Reuben 120 - Datetime Addition
Post by: Reuben B. on April 11, 2022, 01:38:55 am
Rene reminded me about the UNITS operator which could shorten my example even further so I added a small paragraph and included that in the code example.

Reuben