<?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>Date time validation</title><link>https://community.appian.com/discussions/f/user-interface/40175/date-time-validation</link><description>I have a requirement I have datetime component user can select the time maximum 2 hours from their current time else there should be validation error , i want to show the current time defaulted in the time field and they should select the time upto 2</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Date time validation</title><link>https://community.appian.com/thread/153472?ContentTypeID=1</link><pubDate>Tue, 10 Feb 2026 14:17:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c7687621-85e6-48f1-b4de-df01bf81a701</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;In addition to this, if you&amp;#39;re pre-setting the value i.e. in &amp;quot;local!selectedTime&amp;quot;, and it&amp;#39;s the save target as seen here, assuming it&amp;#39;s in a task where the value is expected to be saved somewhere, the &amp;quot;Submit&amp;quot; button (preferably, among various options) will need to make sure to save the value contained in &amp;quot;local!selectedTime&amp;quot; into the Rule Input value (and/or whatever CDT or Record Data is being passed out of the form upon submission), otherwise the user&amp;#39;s selected value will just get lost upon submission.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time validation</title><link>https://community.appian.com/thread/153470?ContentTypeID=1</link><pubDate>Tue, 10 Feb 2026 09:57:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:28110a67-15cf-4015-a0a7-aa9fe6ada5c9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I suggest to use the&amp;nbsp;a!addDateTime() function as it is included in the base product.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time validation</title><link>https://community.appian.com/thread/153469?ContentTypeID=1</link><pubDate>Tue, 10 Feb 2026 09:39:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1feb9887-f2c1-4082-9535-22b355a9e7e0</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Try this&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!selectedTime: now(),
  a!dateTimeField(
    label: &amp;quot;Select Time (max 2h from now)&amp;quot;,
    value: local!selectedTime,
    saveInto: local!selectedTime,
    validations: (
      if(
        local!selectedTime &amp;gt; addhours(now(), 2),
        &amp;quot;Select time within 2 hours from current time&amp;quot;,
        {}
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>