<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Validate dates and times</title><link>https://community.appian.com/discussions/f/general/14837/validate-dates-and-times</link><description>Hello! I need help :) 
 I have a doubt that I do not know how to do it. 
 I want to validate the hours field and the minutes field in this way: 
 • From April 1 to September 30, effective hours will be 7. 
 • From October 1 to March 31, the effective</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66442?ContentTypeID=1</link><pubDate>Thu, 09 May 2019 07:09:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:082244d9-84d6-4fe3-9d10-221710c13414</guid><dc:creator>Alastr</dc:creator><description>&lt;p&gt;Thank you so much for helping me!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66412?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 11:32:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1f4ba33c-ea08-4892-9b2d-60ac9707322f</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;if(&lt;br /&gt; /*From April 1 to September 30 */&lt;br /&gt; and(&lt;br /&gt; today() &amp;gt;= todate(&lt;br /&gt; concat(&lt;br /&gt; &amp;quot;04/01/&amp;quot;,&lt;br /&gt; year(&lt;br /&gt; today()&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; today() &amp;lt;= todate(&lt;br /&gt; concat(&lt;br /&gt; &amp;quot;09/30/&amp;quot;,&lt;br /&gt; year(&lt;br /&gt; today()&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; /*true means date is in between April 1 to September 30*/&lt;br /&gt; {&lt;br /&gt; hours: 7,&lt;br /&gt; minutes: 0&lt;br /&gt; },&lt;br /&gt; /*false means date is in between October 1 to March 31*/&lt;br /&gt; {&lt;br /&gt; hours: 7,&lt;br /&gt; minutes: 33&lt;br /&gt; }&lt;br /&gt; )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66410?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 11:08:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9460640a-03a9-43bb-aa37-b85a47cfa9f4</guid><dc:creator>Alastr</dc:creator><description>&lt;p&gt;&lt;span&gt;As this example that has happened to me, I should be alone. It gives me back 7 what I write. Now I should measure up to the date of October 1 to March 31 and keep me 7 and 33&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;if (&lt;br /&gt;or (&lt;br /&gt;todate (now ())&amp;gt; = todate (&amp;quot;4/1 /&amp;quot;, year (now ())),&lt;br /&gt;todate (now ()) &amp;lt;= todate (&amp;quot;9/30 /&amp;quot;, year (now ()))&lt;br /&gt;),&lt;br /&gt;7,&lt;br /&gt;30&lt;br /&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66409?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:57:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:62cb02a3-c9f0-434e-b9e2-021dfcd6d0d1</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!date: today(),
  local!hours,
  local!minute,
  local!validationData: if(
    and(
      local!date &amp;gt;= todate(
        concat(
          &amp;quot;04/01/&amp;quot;,
          year(
            local!date
          )
        )
      ),
      local!date &amp;lt;= todate(
        concat(
          &amp;quot;09/30/&amp;quot;,
          year(
            local!date
          )
        )
      )
    ),
    {
      hours: 7,
      minutes: 0
    },
    {
      hours: 7,
      minutes: 33
    }
  ),
  {
    a!sideBySideLayout(
      items: {
        a!sideBySideItem(
          item: a!integerField(
            labelPosition: &amp;quot;ABOVE&amp;quot;,
            value: local!hours,
            saveInto: {
              local!hours
            },
            align: &amp;quot;LEFT&amp;quot;,
            validations: if(
              isnull(
                local!hours
              ),
              {},
              if(
                local!hours &amp;gt; tointeger(
                  local!validationData.hours
                ),
                &amp;quot;Not Valid&amp;quot;,
                {}
              )
            )
          ),
          width: &amp;quot;MINIMIZE&amp;quot;
        ),
        a!sideBySideItem(
          item: a!textField(
            labelPosition: &amp;quot;ABOVE&amp;quot;,
            value: &amp;quot; Hours &amp;quot;,
            readOnly: true
          ),
          width: &amp;quot;MINIMIZE&amp;quot;
        ),
        a!sideBySideItem(
          item: a!integerField(
            labelPosition: &amp;quot;ABOVE&amp;quot;,
            value: local!minute,
            saveInto: {
              local!minute
            },
            validations: if(
              isnull(
                local!minute
              ),
              {},
              if(
                local!minute &amp;gt; tointeger(
                  local!validationData.minutes
                ),
                &amp;quot;Not Valid&amp;quot;,
                {}
              )
            )
          ),
          width: &amp;quot;MINIMIZE&amp;quot;
        ),
        a!sideBySideItem(
          item: a!textField(
            labelPosition: &amp;quot;ABOVE&amp;quot;,
            value: &amp;quot; Minute&amp;quot;,
            readOnly: true
          )
        )
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;so when your form is loading ,we are saving date in a local variable based on local date local variable ,we are getting validation data,&lt;/p&gt;
&lt;p&gt;like if date is in between 04/01/year and 09/30/year the the&amp;nbsp; &amp;nbsp;&lt;span&gt;validation data will be&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;{&lt;br /&gt; hours: 7,&lt;br /&gt; minutes: 0&lt;br /&gt; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;other than that the&amp;nbsp;&lt;/span&gt;&lt;span&gt;validation data will be&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;{&lt;br /&gt; hours: 7,&lt;br /&gt; minutes: 33&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;so if user enter more values than that then showing a validation message&amp;nbsp; like &amp;quot;Not Valid &amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66408?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:52:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6fadc599-963b-430d-a9d1-82239560579f</guid><dc:creator>Alastr</dc:creator><description>&lt;p&gt;&lt;span&gt;depending on the current date of when the page will be, &amp;nbsp;I just have to enter each field &amp;nbsp;7 hours From April 1 to September 30 7 hours and 33 minutes From October 1 to March 31&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66407?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:51:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b60c93f5-7b0f-4bcf-802e-96c236dab737</guid><dc:creator>jaishankarj</dc:creator><description>&lt;p&gt;In that case (where you want the fields to be auto populated), you can do&amp;nbsp;that using&amp;nbsp;if condition for your minute field as your hour filed is always going to be 7 hours. Use the following in display value for the Integer Field and should be fine. You can refine the following to make it more compact by having the value to check against in some local variables or constants to use in IF condition:&lt;/p&gt;
&lt;p&gt;For example, in display value field for your minutes field you can use:&lt;/p&gt;
&lt;p&gt;if(&lt;br /&gt; OR(&lt;br /&gt; todate(now()) &amp;gt;= todate(&amp;quot;4/1/&amp;quot;,year(now())),&lt;br /&gt; todate(now()) &amp;lt;= todate(&amp;quot;9/30/&amp;quot;,year(now()))&lt;br /&gt; ),&lt;br /&gt; 0,&lt;br /&gt; 30&lt;br /&gt; ),&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66406?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:42:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0115e756-adef-4639-8aff-dafe3a9a496c</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;from where you will get the date ,from start time of task ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66405?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:40:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8864f153-d32e-40e4-ac73-04a40c9f0cc0</guid><dc:creator>Alastr</dc:creator><description>&lt;p&gt;&lt;span&gt;the hours and minutes fields must be initialized when loading the page with 7 hours From April 1 to September 30 7 hours and 33 minutes From October 1 to March 31&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66404?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:24:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:32ebaa4b-f424-4752-a564-6edc122bc0a0</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;hours and minutes are auto populated or user will enter it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66403?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 10:19:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9baa39d9-cc2e-4d21-846f-b7d923e7ee7a</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;load(&lt;br /&gt; local!date,&lt;br /&gt; local!hours,&lt;br /&gt; local!minute,&lt;br /&gt; local!validationData,&lt;br /&gt; {&lt;br /&gt; a!dateField(&lt;br /&gt; label: &amp;quot;Date&amp;quot;,&lt;br /&gt; value: local!date,&lt;br /&gt; saveInto: {&lt;br /&gt; local!date,&lt;br /&gt; a!save(&lt;br /&gt; local!validationData,&lt;br /&gt; if(&lt;br /&gt; isnull(&lt;br /&gt; local!date&lt;br /&gt; ),&lt;br /&gt; {},&lt;br /&gt; if(&lt;br /&gt; and(&lt;br /&gt; local!date &amp;gt;= todate(&lt;br /&gt; concat(&lt;br /&gt; &amp;quot;04/01/&amp;quot;,&lt;br /&gt; year(&lt;br /&gt; local!date&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; local!date &amp;lt;= todate(&lt;br /&gt; concat(&lt;br /&gt; &amp;quot;09/30/&amp;quot;,&lt;br /&gt; year(&lt;br /&gt; local!date&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; {&lt;br /&gt; hours: 7,&lt;br /&gt; minutes: 0&lt;br /&gt; },&lt;br /&gt; {&lt;br /&gt; hours: 7,&lt;br /&gt; minutes: 30&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; a!save(&lt;br /&gt; local!hours,&lt;br /&gt; null&lt;br /&gt; ),&lt;br /&gt; a!save(&lt;br /&gt; local!minute,&lt;br /&gt; null&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt; ),&lt;br /&gt; a!sideBySideLayout(&lt;br /&gt; items: {&lt;br /&gt; a!sideBySideItem(&lt;br /&gt; item: a!integerField(&lt;br /&gt; labelPosition: &amp;quot;ABOVE&amp;quot;,&lt;br /&gt; value: local!hours,&lt;br /&gt; saveInto: {&lt;br /&gt; local!hours&lt;br /&gt; },&lt;br /&gt; align: &amp;quot;LEFT&amp;quot;,&lt;br /&gt; readOnly: if(&lt;br /&gt; isnull(&lt;br /&gt; local!date&lt;br /&gt; ),&lt;br /&gt; true(),&lt;br /&gt; false()&lt;br /&gt; ),&lt;br /&gt; validations: if(&lt;br /&gt; isnull(&lt;br /&gt; local!hours&lt;br /&gt; ),&lt;br /&gt; {},&lt;br /&gt; if(&lt;br /&gt; local!hours &amp;gt; tointeger(&lt;br /&gt; local!validationData.hours&lt;br /&gt; ),&lt;br /&gt; &amp;quot;Not Valid&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; width: &amp;quot;MINIMIZE&amp;quot;&lt;br /&gt; ),&lt;br /&gt; a!sideBySideItem(&lt;br /&gt; item: a!textField(&lt;br /&gt; labelPosition: &amp;quot;ABOVE&amp;quot;,&lt;br /&gt; value: &amp;quot; Hours &amp;quot;,&lt;br /&gt; readOnly: true&lt;br /&gt; ),&lt;br /&gt; width: &amp;quot;MINIMIZE&amp;quot;&lt;br /&gt; ),&lt;br /&gt; a!sideBySideItem(&lt;br /&gt; item: a!integerField(&lt;br /&gt; labelPosition: &amp;quot;ABOVE&amp;quot;,&lt;br /&gt; value: local!minute,&lt;br /&gt; saveInto: {&lt;br /&gt; local!minute&lt;br /&gt; },&lt;br /&gt; readOnly: if(&lt;br /&gt; isnull(&lt;br /&gt; local!date&lt;br /&gt; ),&lt;br /&gt; true(),&lt;br /&gt; false()&lt;br /&gt; ),&lt;br /&gt; validations: if(&lt;br /&gt; isnull(&lt;br /&gt; local!minute&lt;br /&gt; ),&lt;br /&gt; {},&lt;br /&gt; if(&lt;br /&gt; local!minute &amp;gt; tointeger(&lt;br /&gt; local!validationData.minutes&lt;br /&gt; ),&lt;br /&gt; &amp;quot;Not Valid&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; width: &amp;quot;MINIMIZE&amp;quot;&lt;br /&gt; ),&lt;br /&gt; a!sideBySideItem(&lt;br /&gt; item: a!textField(&lt;br /&gt; labelPosition: &amp;quot;ABOVE&amp;quot;,&lt;br /&gt; value: &amp;quot; Minute&amp;quot;,&lt;br /&gt; readOnly: true&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66402?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 09:51:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4b213f63-7b91-4818-a7fe-b73d288ae4b9</guid><dc:creator>Alastr</dc:creator><description>&lt;pre class="tw-data-text tw-ta tw-text-small" id="tw-target-text" dir="ltr"&gt;&lt;span lang="en"&gt;&lt;span&gt;The effective hours and minutes will be an automatically modified and initialized field with values &lt;br /&gt;​​depending on the creation date of the input task: &lt;br /&gt;&amp;bull; From April 1 to September 30, effective hours will be 7. &lt;br /&gt;&amp;bull; From October 1 to March 31, the effective hours will be 7 and the minutes will be 33.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;thanks&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Validate dates and times</title><link>https://community.appian.com/thread/66401?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 09:44:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3b10b3c1-0979-42c1-89d6-0ce4d420a9bd</guid><dc:creator>jaishankarj</dc:creator><description>&lt;p&gt;Hi Alastr, as this is not clear from the query whether you want the validation at the text field level (i.e. when the value gets populated) OR while submitting the form, you can validate this in&amp;nbsp;different ways. A simple way is as follows (just for reference):&lt;/p&gt;
&lt;p&gt;Use the validations option available for the text field component and use if conditions to validate the hours and minutes within the range. You can have the date range in a constant OR local variables. For example -&amp;nbsp;validations: if(and(day(now())&amp;gt;=1,month(now())&amp;gt;=4,ri!Regis.hours&amp;gt;7), &amp;quot;Can&amp;#39;t be more than 7&amp;quot;, {})&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>