<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automatic Date calculation in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Automatic-Date-calculation/m-p/220031#M3799</link>
    <description>I have done this using the Date/Time extension (I think that is what they call it).&lt;BR /&gt;
It might work the same with a REQUEST&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;realdaynum = 0
realmonthnum = 0
realyearnum = 0

dateStr = ""
ch = OPEN ("DateTime", "", "%d/%m/%Y")
n = INPUT (ch, "", "", dateStr)
CLOSE (ch)

!!print dateStr

n=SPLIT(dateStr ,"%n %s %n %s %n",realdaynum,string_1,realmonthnum,string_2,realyearnum)

!!print realdaynum
!!print string_1
!!print realmonthnum
!!print string_2
!!print realyearnum&lt;/PRE&gt;

&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The problem is this will always be looking for the current date so you new date will always be 5 years ahead.&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
So you will want something like this (in your master script).&lt;BR /&gt;

&lt;PRE&gt;if update_swch = 1 then

realdaynum = 0
realmonthnum = 0
realyearnum = 0

dateStr = ""
ch = OPEN ("DateTime", "", "%d/%m/%Y")
n = INPUT (ch, "", "", dateStr)
CLOSE (ch)

!!print dateStr

n=SPLIT(dateStr ,"%n %s %n %s %n",realdaynum,string_1,realmonthnum,string_2,realyearnum)

!!print realdaynum
!!print string_1
!!print realmonthnum
!!print string_2
!!print realyearnum&lt;/PRE&gt;

PARAMETERS update_swch = 0&lt;BR /&gt;
&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
Every time you turn ON the update switch it will re-calculate the date and the switch will automatically set back to OFF.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
    <pubDate>Wed, 04 Nov 2020 01:23:56 GMT</pubDate>
    <dc:creator>Barry Kelly</dc:creator>
    <dc:date>2020-11-04T01:23:56Z</dc:date>
    <item>
      <title>Automatic Date calculation</title>
      <link>https://community.graphisoft.com/t5/GDL/Automatic-Date-calculation/m-p/220030#M3798</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I'm wondering if it's possible to write a gdl object to calculate a future date from the current date?&lt;BR /&gt;&lt;BR /&gt;I'm aware of using a REQUEST to get current system date into the format that I need, for example &lt;BR /&gt;&lt;BR /&gt;x = REQUEST ("DateTime", "%d.%m.%Y", datetimestring) will show me 04.11.2020 for today.&lt;BR /&gt;&lt;BR /&gt;What I want to do is then have the object automatically calculate a date in the future from that date.&lt;BR /&gt;&lt;BR /&gt;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".&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;So is this possible with GDL in ArchiCAD 24?&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Sep 2021 07:32:10 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Automatic-Date-calculation/m-p/220030#M3798</guid>
      <dc:creator>Andrew Swenson</dc:creator>
      <dc:date>2021-09-15T07:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Date calculation</title>
      <link>https://community.graphisoft.com/t5/GDL/Automatic-Date-calculation/m-p/220031#M3799</link>
      <description>I have done this using the Date/Time extension (I think that is what they call it).&lt;BR /&gt;
It might work the same with a REQUEST&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;realdaynum = 0
realmonthnum = 0
realyearnum = 0

dateStr = ""
ch = OPEN ("DateTime", "", "%d/%m/%Y")
n = INPUT (ch, "", "", dateStr)
CLOSE (ch)

!!print dateStr

n=SPLIT(dateStr ,"%n %s %n %s %n",realdaynum,string_1,realmonthnum,string_2,realyearnum)

!!print realdaynum
!!print string_1
!!print realmonthnum
!!print string_2
!!print realyearnum&lt;/PRE&gt;

&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The problem is this will always be looking for the current date so you new date will always be 5 years ahead.&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
So you will want something like this (in your master script).&lt;BR /&gt;

&lt;PRE&gt;if update_swch = 1 then

realdaynum = 0
realmonthnum = 0
realyearnum = 0

dateStr = ""
ch = OPEN ("DateTime", "", "%d/%m/%Y")
n = INPUT (ch, "", "", dateStr)
CLOSE (ch)

!!print dateStr

n=SPLIT(dateStr ,"%n %s %n %s %n",realdaynum,string_1,realmonthnum,string_2,realyearnum)

!!print realdaynum
!!print string_1
!!print realmonthnum
!!print string_2
!!print realyearnum&lt;/PRE&gt;

PARAMETERS update_swch = 0&lt;BR /&gt;
&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
Every time you turn ON the update switch it will re-calculate the date and the switch will automatically set back to OFF.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
      <pubDate>Wed, 04 Nov 2020 01:23:56 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Automatic-Date-calculation/m-p/220031#M3799</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2020-11-04T01:23:56Z</dc:date>
    </item>
  </channel>
</rss>

