<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.vital-soft.com/index.php?action=history&amp;feed=atom&amp;title=Setting_the_Logical_Date</id>
	<title>Setting the Logical Date - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.vital-soft.com/index.php?action=history&amp;feed=atom&amp;title=Setting_the_Logical_Date"/>
	<link rel="alternate" type="text/html" href="https://wiki.vital-soft.com/index.php?title=Setting_the_Logical_Date&amp;action=history"/>
	<updated>2026-07-28T11:34:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.10</generator>
	<entry>
		<id>https://wiki.vital-soft.com/index.php?title=Setting_the_Logical_Date&amp;diff=3575&amp;oldid=prev</id>
		<title>Johno at 19:30, 19 January 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.vital-soft.com/index.php?title=Setting_the_Logical_Date&amp;diff=3575&amp;oldid=prev"/>
		<updated>2023-01-19T19:30:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 19:30, 19 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;With AskPlus version E.8.2.1 and higher it is possible to set a global reference date (ASK_REFDATE) that will override the system date returned by $SECONDS, which is the AskPlus variable that returns the current date and time in internal format.&amp;#160; When ASK_REFDATE is set, $SECONDS will return a value that corresponds to the specified date and the current time.&amp;#160; Setting this reference date allows you to run a report and have it&amp;#039;s date calculations behave as though it had been run on the specified logical date.&amp;#160; (Keep in mind that the data will not necessarily be the same as it was on the reference date.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;With AskPlus version E.8.2.1 and higher it is possible to set a global reference date (ASK_REFDATE) that will override the system date returned by $SECONDS, which is the AskPlus variable that returns the current date and time in internal format.&amp;#160; When ASK_REFDATE is set, $SECONDS will return a value that corresponds to the specified date and the current time.&amp;#160; Setting this reference date allows you to run a report and have it&amp;#039;s date calculations behave as though it had been run on the specified logical date.&amp;#160; (Keep in mind that the data will not necessarily be the same as it was on the reference date.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ASK_REFDATE effects the system variables $SECONDS, $TODAY, $YESTERDAY. All other date system variables are based on the actual date.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ASK_REFDATE effects the system variables $SECONDS, $TODAY, $YESTERDAY. All other date system variables are based on the actual date.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Since many date macros (%CYMD-TODAY, %CYMD-YESTERDAY, %FDAY-PRI-MO, etc) use $SECONDS to perform the date calculation, these macros are all impacted by ASK_REFDATE.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ASK_REFDATE will only be used if it contains a valid date.&amp;#160; If the value is zero, or some other invalid date, it will be ignored and the current date will be used.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ASK_REFDATE will only be used if it contains a valid date.&amp;#160; If the value is zero, or some other invalid date, it will be ignored and the current date will be used.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== How to set ASK_REFDATE ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The AskPlus logical date can be set in two ways:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* In a UNIX script by setting a system variable called ASK_REFDATE&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* In Visimage3 (or AskPlus code) by creating a &amp;#039;&amp;#039;&amp;#039;Global&amp;#039;&amp;#039;&amp;#039; variable called ASK_REFDATE&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Using the Macro DFLT-HR-OFFSET ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This macro is used by many date macros to calculate the current date. It is designed to create a time window (after midnight) for jobs that may run after midnight, to use the previous day for today. For example, when DFLT-HR-OFFSET is set to 6 hours, jobs that run between midnight and 6:00 am will use the previous day as today&amp;#039;s date. Provided you use the macro definition shown below, DFLT-HR-OFFSET will be ignored when ASK_REFDATE is set.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; macro DFLT-HR-OFFSET = !IIF((6 * 3600) splice &amp;quot;|&amp;quot; splice 0, &amp;amp;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  (!datext($SECONDS, &amp;quot;cymd&amp;quot;) = (($YEAR * 10000) + ($MONTH * 100) + $MONTHDAY)))&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The DFLT-HR-OFFSET is actually set to a number of seconds. The above is setting the offset to 6 hours (6 * 3600) because there are 3600 seconds in an hour.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Johno</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.vital-soft.com/index.php?title=Setting_the_Logical_Date&amp;diff=2779&amp;oldid=prev</id>
		<title>&gt;Johno: Created page with &quot;=== Current System Date === Most of the common date calculations performed by AskPlus use the current system date as the reference date.  For instance, %DAYS-OLD(d1) returns t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.vital-soft.com/index.php?title=Setting_the_Logical_Date&amp;diff=2779&amp;oldid=prev"/>
		<updated>2020-07-08T20:32:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Current System Date === Most of the common date calculations performed by AskPlus use the current system date as the reference date.  For instance, %DAYS-OLD(d1) returns t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Current System Date ===&lt;br /&gt;
Most of the common date calculations performed by AskPlus use the current system date as the reference date.  For instance, %DAYS-OLD(d1) returns the number of days between any specified date (d1) and the current system date.  Many times, however, reports require date calculations based on a different date, ie the end of the previous month, or yesterday&amp;#039;s date. &lt;br /&gt;
&lt;br /&gt;
=== Setting a Logical Date ===&lt;br /&gt;
With AskPlus version E.8.2.1 and higher it is possible to set a global reference date (ASK_REFDATE) that will override the system date returned by $SECONDS, which is the AskPlus variable that returns the current date and time in internal format.  When ASK_REFDATE is set, $SECONDS will return a value that corresponds to the specified date and the current time.  Setting this reference date allows you to run a report and have it&amp;#039;s date calculations behave as though it had been run on the specified logical date.  (Keep in mind that the data will not necessarily be the same as it was on the reference date.)&lt;br /&gt;
* ASK_REFDATE effects the system variables $SECONDS, $TODAY, $YESTERDAY. All other date system variables are based on the actual date.&lt;br /&gt;
* ASK_REFDATE will only be used if it contains a valid date.  If the value is zero, or some other invalid date, it will be ignored and the current date will be used.&lt;/div&gt;</summary>
		<author><name>&gt;Johno</name></author>
		
	</entry>
</feed>