<?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>Converting 6 Jan 2021 21:19:42 GMT text into a date and time</title><link>https://community.appian.com/discussions/f/general/20238/converting-6-jan-2021-21-19-42-gmt-text-into-a-date-and-time</link><description>What is the best way people have found to convert 6 Jan 2021 21:19:42 GMT text into date and time?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Converting 6 Jan 2021 21:19:42 GMT text into a date and time</title><link>https://community.appian.com/thread/79032?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 17:03:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e1d5e7f5-79d5-48ab-a8a5-38efa546381d</guid><dc:creator>davidh0020</dc:creator><description>&lt;p&gt;Here is an alternative that uses regex if that&amp;#39;s an option for you. The only reason I like this solution slightly better is that it can be modified to accept&amp;nbsp;slightly different formats more easily. The downside is that I think regex will take slightly more time (very slightly more).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Just posting for other ideas in the future if people need them.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!userDateText: &amp;quot;6 Jan 2021 21:01:10 GMT&amp;quot;,
  local!months: {
    &amp;quot;Jan&amp;quot;: 1,
    &amp;quot;Feb&amp;quot;: 2,
    &amp;quot;Mar&amp;quot;: 3/*  Continue for all months  */

  },
  local!day: regexfirstmatch(&amp;quot;^\d+&amp;quot;, local!userDateText, &amp;quot;i&amp;quot;),
  local!month: index(
    local!months,
    regexfirstmatch(&amp;quot;[a-zA-Z]{3}&amp;quot;, local!userDateText),
    0
  ),
  local!year: regexfirstmatch(&amp;quot;\d\d\d\d&amp;quot;, local!userDateText, &amp;quot;i&amp;quot;),
  local!time: regexfirstmatch(&amp;quot;\d+:\d+:\d+&amp;quot;, local!userDateText, &amp;quot;i&amp;quot;),
  local!hour: split(local!time, &amp;quot;:&amp;quot;)[1],
  local!min: split(local!time, &amp;quot;:&amp;quot;)[2],
  local!sec: split(local!time, &amp;quot;:&amp;quot;)[3],
  {
    datetime(
      local!year,
      local!month,
      local!day,
      local!hour,
      local!min,
      local!sec
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Converting 6 Jan 2021 21:19:42 GMT text into a date and time</title><link>https://community.appian.com/thread/78987?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 15:20:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cd36af90-8176-47c5-972b-9a07060932e2</guid><dc:creator>Danny Verb</dc:creator><description>&lt;p&gt;f the format will always be consistent, you can create an expression rule to convert your string into a datetime.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!months: {
    &amp;quot;Jan&amp;quot;,
    &amp;quot;Feb&amp;quot;,
    &amp;quot;Mar&amp;quot;
  },
  local!string: &amp;quot;6 Jan 2021 21:19:42 GMT&amp;quot;,
  local!date: trim(left(local!string, 11)),
  local!time: totime(trim(right(local!string,12))),
  local!year: right(local!date,4),
  local!day: trim(left(local!date,2)),
  local!month: wherecontains(trim(mid(local!date,3,4)),local!months),
  datetime(local!year,local!month,local!day,hour(local!time),minute(local!time),second(local!time))
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>