<?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>Facing issue with date comparison</title><link>https://community.appian.com/discussions/f/new-to-appian/22098/facing-issue-with-date-comparison</link><description>Hi, 
 I am trying to compare two dates one is stored in DB (lets call it dbValue) and another one is from now ( ). 
 Now, where I have : 
 
 dbValue: 10/02/2021 09:00 AM 
 now: 10/1/2021 9:18 AM EDT 
 dbValue&amp;lt;now 
 it gives me true 
 
 dbValue: 09/30</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Facing issue with date comparison</title><link>https://community.appian.com/thread/86553?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 17:39:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b5e4b818-dd1a-4b48-a8d4-42a170fce5da</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Also to note, the todatetime() function applies a timezone offset, &amp;quot;todatetime(&amp;quot;10/02/2021 09:00 AM&amp;quot;)&amp;quot; in eastern time will return &lt;strong&gt;5 AM ET&lt;/strong&gt;.&amp;nbsp; To return the actual text value of the time, apply gmt() as:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;gmt(todatetime(&amp;quot;10/02/2021 09:00 AM&amp;quot;))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It is also strongly encouraged to use proper data types when storing to the DB, storing such things as datetime values as text will most certainly present issues down the road.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Facing issue with date comparison</title><link>https://community.appian.com/thread/86549?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 14:09:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:283c377e-a921-4374-92dd-f9490fd3eeb1</guid><dc:creator>shamima0001</dc:creator><description>&lt;p&gt;Thanks it worked, I had dbValue stored in text format.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Facing issue with date comparison</title><link>https://community.appian.com/thread/86548?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 13:53:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b7a87290-9f2f-4375-bd9c-de9ef31165c5</guid><dc:creator>hrishikeshd997</dc:creator><description>&lt;p&gt;Is your dbValue a local variable or a rule input of date and time type? If its a rule input of the same data type as now() there shouldn&amp;#39;t be an issue if not then it is comparing a text with a timestamp which will not give desired output. Try converting it using todatetime&amp;nbsp;before comparison and it should work.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;todatetime(&amp;quot;10/02/2021 09:00 AM&amp;quot;) &amp;lt; now()&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>