2020-11-0305:01 PM - last edited on 2021-09-1512:32 AM by Noemi Balogh
I'm wondering if it's possible to write a gdl object to calculate a future date from the current date?
I'm aware of using a REQUEST to get current system date into the format that I need, for example
x = REQUEST ("DateTime", "%d.%m.%Y", datetimestring) will show me 04.11.2020 for today.
What I want to do is then have the object automatically calculate a date in the future from that date.
Why? Well I'm doing some Building Evacuation Plans for a client and they have a validity period of 5 years. It would be nice to have an object that shows the current date as the "Date issued" and then calculate and show the "Valid till Date".
I'm thinking (based on using excel to do the same thing) I would need to convert the date into a numerical figure (assuming ArchiCAD works with numerical dates) add the correct number of days to the number and then 'formt' the resulting number back into day month and year.
So is this possible with GDL in ArchiCAD 24?
ArchiCAD 5.1 - 24
MSI WS63 8SL
Intel i7-8850K @ 2.60GHz
Windows 10 Pro 64bit
This will give you number values for the day, month and year that you can add your 5 years to and then reassemble the date.
The problem is this will always be looking for the current date so you new date will always be 5 years ahead.
You need to trap the current date as a fixed date (date of issue) by using a boolean switch (update_swch) that you can activate and will automatically reset back to OFF.
So you will want something like this (in your master script).
if update_swch = 1 then
realdaynum = 0
realmonthnum = 0
realyearnum = 0
dateStr = ""
ch = OPEN ("DateTime", "", "%d/%m/%Y")
n = INPUT (ch, "", "", dateStr)
n=SPLIT(dateStr ,"%n %s %n %s %n",realdaynum,string_1,realmonthnum,string_2,realyearnum)
PARAMETERS update_swch = 0
Every time you turn ON the update switch it will re-calculate the date and the switch will automatically set back to OFF.
One of the forum moderators. Versions 6.5 to 25 Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10 Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10