<?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>Time Zone issue</title><link>https://community.appian.com/discussions/f/general/21331/time-zone-issue</link><description>Hi, 
 I have a scenario where my Database is in GMT and I am trying to convert it to EST time by using GMT function gmt(property(local!data,&amp;quot;XXX&amp;quot;,{}),&amp;quot;EDT&amp;quot;) its working fine during night time but when this function is executed during day time its giving</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83329?ContentTypeID=1</link><pubDate>Fri, 02 Jul 2021 15:23:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ee67661a-e1ad-452a-8038-f4ac3f393555</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;As a side note, I would recommend moving away from the use of load() and with() and migrating toward the newer &lt;a href="https://docs.appian.com/suite/help/21.2/fnc_evaluation_a_localvariables.html"&gt;a!localVariables() function&lt;/a&gt; for variable declarations.&lt;/p&gt;
&lt;p&gt;To clarify on the date situation here, are you trying to always use the exact date value of what is in the DB, or do you need to add an offset for timezone, which will change the date at certain times of the day?&lt;/p&gt;
&lt;p&gt;If you just want a straight date, try:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;if(
    rule!APN_isEmpty(ri!dateValue),
    &amp;quot;&amp;quot;,
    date(
      year(ri!dateValue),
      month(ri!dateValue),
      day(ri!dateValue)
    )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83286?ContentTypeID=1</link><pubDate>Fri, 02 Jul 2021 03:25:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fdde76cb-d904-4703-9690-33fd1940e7f8</guid><dc:creator>Jagan c</dc:creator><description>&lt;p&gt;I tried using the code provided still I am getting one date minus.&lt;/p&gt;
&lt;p&gt;The data in DB is&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1625196028093v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;and when try with the code provide it&amp;#39;s giving me the below result&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1625196239788v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;We are using the below code as suggested.&lt;/p&gt;
&lt;p&gt;load(&lt;br /&gt; local!userTimeZone:usertimezone(loggedInUser()),&lt;br /&gt; if(rule!APN_isEmpty(ri!dateValue),&amp;quot;&amp;quot;,todate(local(ri!dateValue,local!userTimeZone)))&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83199?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 21:09:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4fd058d4-7b3c-4d01-b3f3-0fb899a2c10a</guid><dc:creator>chanakyav0002</dc:creator><description>&lt;p&gt;That is the main point to missed mentioning. todate() function treats the input as GMT. You should always have your custom expression rule to convert datetime to date.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*Converts Datetime to date based on passed user. If no user is passed loggedInUser will be considered
*/

a!localVariables(
  local!user : if(
    rule!RWP_isNullOrEmpty(ri!user),
    loggedInUser(),
    ri!user
  ),
  local!timeZone : usertimezone(local!user),
  if(
    rule!RWP_isNullOrEmpty(ri!dateTime),
    ri!dateTime,
    todate(local(ri!dateTime, local!timeZone))
  )&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83198?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 21:04:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6c7efdc2-153f-41d2-b195-145aedbdfb14</guid><dc:creator>Jagan c</dc:creator><description>&lt;p&gt;Hi Chanakya,&lt;/p&gt;
&lt;p&gt;I tried using &amp;nbsp;&lt;em&gt;&lt;strong&gt;&lt;span&gt;property(local!data,&amp;quot;XXX&amp;quot;,{})&lt;/span&gt; &lt;/strong&gt;and&lt;strong&gt; todate(property(local!data,&amp;quot;XXX&amp;quot;,{})) &lt;/strong&gt;&lt;/em&gt;both gave&amp;nbsp; future date at 8pm, am I doing something wrong here can you please post the code which I can use to achieve correct date even if I make a request in the night time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83194?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 20:36:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fe46c057-7986-4ba2-aa7a-da12839b1816</guid><dc:creator>chanakyav0002</dc:creator><description>&lt;p&gt;Hi Jagan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think that is possible unless you are doing todate() or something on the datatime value retrieved from DB&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83193?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 20:31:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bfa46e39-16a5-4c7a-baa0-67ecbc0b0d0a</guid><dc:creator>Jagan c</dc:creator><description>&lt;p&gt;Thanks for your replay Chris,&lt;/p&gt;
&lt;p&gt;If I do not convert to EST(property(local!data,&amp;quot;XXX&amp;quot;,{})) its working fine until 8PM but when you make a request after 8PM its giving future date(current date+1)&amp;nbsp;&lt;em&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83185?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 18:18:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b1ac8860-b151-4606-925d-c0f40d9bdbee</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;What the initial reply here was indicating is that, your data is in GMT in the database, you are retrieving it into local!data at which time Appian is &lt;em&gt;automatically&lt;/em&gt; applying the EDT offset.&amp;nbsp; When you then wrap with gmt(), you are adding an additional EST offset / doubling it, pushing it 4 hours into the next day.&lt;/p&gt;
&lt;p&gt;To troubleshoot, review a specific time in the DB, then on your interface review the value of&amp;nbsp;&lt;em&gt;&lt;strong&gt;property(local!data,&amp;quot;XXX&amp;quot;,{})&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83184?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 18:09:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3a4985ec-1fc4-4dfd-ac30-00fdb80e994f</guid><dc:creator>Jagan c</dc:creator><description>&lt;p&gt;Thanks for your replay,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My profile Time zone is in EST only and if I use it directly its working fine in day time but in the night time(8PM)&amp;nbsp; it adds 1 day to the current date, that is why I am converting it to EST by using this function&amp;nbsp;&lt;span&gt;&amp;nbsp;gmt(property(local!data,&amp;quot;XXX&amp;quot;,{}),&amp;quot;EDT&amp;quot;)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time Zone issue</title><link>https://community.appian.com/thread/83179?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 17:11:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c3ab6224-06dd-4165-9445-a16a2d5d5a75</guid><dc:creator>chanakyav0002</dc:creator><description>&lt;p&gt;When you query from database using QueryEntity the datetimes will be converted to loggedInUser default timezone. You don&amp;#39;t have to do any convertions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>