<?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>How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/discussions/f/general/18500/how-to-convert-date-time-value-in-gmt-to-value-in-a-specific-time-zone</link><description>As our application requirement, we have a date-time value in GMT that loaded from database, and we want to convert it to value in a specific time zone (example: America/Chicago).</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72850?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 18:22:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:08efa19d-951f-4f36-b118-185d464846fc</guid><dc:creator>TrBaPhong</dc:creator><description>&lt;p&gt;thanks Mike for your warning.&lt;/p&gt;
&lt;div class="ddict_btn" style="left:177px;top:17px;"&gt;&lt;/div&gt;
&lt;div class="ddict_btn" style="left:177px;top:17px;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72847?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 18:15:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38b656c7-6939-4020-a4e6-827d9b3af139</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;cool - in the mean time i submit that it might behave differently in a running process (for example) than it behaves for you in the expression editor, so depending on how you plan to use it, i suggest you test in advance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72846?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 18:14:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30f2042e-852d-4ed5-83fd-d063cacbaf20</guid><dc:creator>TrBaPhong</dc:creator><description>&lt;p&gt;userdatetime() function did the trick. Thanks Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72841?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 16:35:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8b7fabbb-88a9-4ccd-98da-f9fc830ae4a1</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;This is tricky - when you run &amp;quot;datetime(2020,03,24,11,0,0)&amp;quot;, i.e. from the expression rule editor, it interprets the resulting value already converted to your user preferred time zone, so then running local() on that result generates an incorrect value.&amp;nbsp; AFAIK this will behave differently if you run it directly on a value pulled from the DB.&amp;nbsp; Also I find that using the function &amp;quot;userdatetime()&amp;quot; in the expression rule editor causes more expected values to be shown.&lt;/p&gt;
&lt;p&gt;All of this depends pretty largely on your particular use case, and overall data source and format -- all I can say is that you should experiment in the expression rule editor with what different things cause different outputs, because I guarantee there&amp;#39;s a way to get what you want, even if it&amp;#39;s a little confusing to get there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72840?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 16:05:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f11435eb-b66e-4fc0-82e8-c5f7643a7fee</guid><dc:creator>TrBaPhong</dc:creator><description>&lt;p&gt;I look for a ConvertTimeFromGMT function that:&lt;/p&gt;
&lt;p&gt;ConvertTimeFromGMT(datetime(2020,03,24,11,0,0,0)&amp;quot;, &amp;quot;America/New_York&amp;quot;) returns 2020-03-24 7:00 AM.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Because 11 AM in GMT is 7 AM New York Time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Both local(&lt;span&gt;datetime(2020,03,24,11,0,0,0)&amp;quot;, &amp;quot;America/New_York&amp;quot;) and gmt(datetime(2020,03,24,11,0,0,0)&amp;quot;, &amp;quot;America/New_York&amp;quot;) does not give me that expected result.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72838?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 15:22:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1c156375-4dd0-49a3-95c2-67a443ad932a</guid><dc:creator>Jim Beckley</dc:creator><description>&lt;p&gt;Good point. the local and gmt functions are opposite of each other, local *adds* a named timezone interval to the base date and time -- gmt *subtracts* a named timezone interval from the base date and time. I think what works best for you may depend on your use case, and I&amp;#39;m not clear on what the full use case or user story is here.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72837?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 15:07:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:917edb79-21dc-4555-8d0b-367c5d6c2a84</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;&lt;em&gt;local()&lt;/em&gt; accepts a time zone parameter, though.&amp;nbsp; Is this not working for you?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72836?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 15:05:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:348faaa6-8068-4c22-9711-6cbc9be1a27d</guid><dc:creator>TrBaPhong</dc:creator><description>&lt;p&gt;Yes, Mike. You are right. I want a opposite of gmt().&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t use the local() because I want to convert to a named timezone, not the timezone in user setting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72835?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 15:03:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dcc7f0a6-703c-407b-ae4f-21e063d6f866</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I&amp;#39;m a little unclear on how that helps in this use case, though - it sounds like the original poster is starting with a GMT database value and wants to show it translated to a named time zone -- the description of the functionality of &lt;em&gt;gmt()&lt;/em&gt; sounds like it inherently does the opposite of that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72834?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 14:59:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bdd916b4-9853-4952-b429-d70d4df16839</guid><dc:creator>Jim Beckley</dc:creator><description>&lt;p&gt;The local function could also be used. However, the gmt function is a date and time subtraction function: The function converts its second parameter, the timezone offset in minutes, to an interval, and subtracts it from the first parameter, the base date and time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72833?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 14:56:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3465c7ef-b992-4d08-9e0e-db35533d9d4e</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Whereas the&amp;nbsp;&lt;em&gt;gmt()&lt;/em&gt; function converts a given date into its GMT equivalent, I think you might be interested more in &lt;a href="https://docs.appian.com/suite/help/19.4/fnc_date_and_time_local.html"&gt;local()&lt;/a&gt;, which does essentially the opposite.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert date time value in GMT to value in a specific time zone</title><link>https://community.appian.com/thread/72832?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 14:52:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cdc955c2-6a36-4292-8f86-9f0244eb5918</guid><dc:creator>Jim Beckley</dc:creator><description>&lt;p&gt;If you&amp;#39;re displaying the datetime value in an interface -- you can store it in an Appian&amp;nbsp; variable or CDT element with a Date &amp;amp; Time data type and it will be automatically converted to the user&amp;#39;s time zone.&lt;/p&gt;
&lt;p&gt;See: &lt;a href="https://docs.appian.com/suite/help/19.4/Appian_Data_Types.html#date-and-time"&gt;https://docs.appian.com/suite/help/19.4/Appian_Data_Types.html#date-and-time&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you need to actively convert it in another context such as an expression rule, you can use the gmt() function, and pass the timezone you want to use.&lt;/p&gt;
&lt;p&gt;gmt(&amp;lt;datetime_DB_value&amp;gt;,&amp;lt;timezone&amp;gt;) &lt;/p&gt;
&lt;p&gt;Such as: gmt(ri!dateTimeFromDB,&amp;quot;Australia/Canberra&amp;quot;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>