<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>if / else based on date variable?</title>
    <link>http://forums.shopify.com/categories/2/posts/28101</link>
    <language>en-us</language>
    <description>Feed for discussion topic if / else based on date variable?</description>
    <item>
      <title>if / else based on date variable?</title>
      <author>Matt Burden</author>
      <pubDate>Fri, 10 Jul 2009 03:44:04 +0000</pubDate>
      <link>http://forums.shopify.com/categories/2/posts/28101</link>
      <guid>http://forums.shopify.com/categories/2/posts/28101</guid>
      <description>&lt;p&gt;Hello,&lt;/p&gt;


	&lt;p&gt;We would like to display a message based on the current local time.&lt;/p&gt;


	&lt;p&gt;pseudo code:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;
if time before 10:15 AM

display message

else

display other message

end if
&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;It does not appear I can set a variable to be the %H so use in my IF statement.&lt;/p&gt;


	&lt;p&gt;Am I being dense?  Do I need sleep?  Can this be accomplished?&lt;/p&gt;


	&lt;p&gt;Thanks in advance.&lt;/p&gt;


	&lt;p&gt;Matt&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jared Burns commented</title>
      <author>Jared Burns</author>
      <pubDate>Fri, 10 Jul 2009 14:30:50 +0000</pubDate>
      <link>http://forums.shopify.com/categories/2/posts/28101#comment-28104</link>
      <guid>http://forums.shopify.com/categories/2/posts/28101#comment-28104</guid>
      <description>&lt;p&gt;You can do it like this&amp;#8230;&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;{% capture current_time %}{{ "now" | date: "%H%M" }}{% endcapture %}
{% if '1515' &amp;lt; current_time %}
    It's before 10:15 AM EST
{% else %}
    It's after 10:15 AM EST
{% endif %}&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The time zone is in &lt;span class="caps"&gt;UTC&lt;/span&gt; using the 24-hour clock, so you&amp;#8217;ll need to change the time you&amp;#8217;re specifying (10:15 AM, for example) to reflect the time zone you&amp;#8217;re in (or want to support). In the example above, 1515 represents 10:15 &lt;span class="caps"&gt;AM EST&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;If you want &lt;span class="caps"&gt;CST&lt;/span&gt;, it&amp;#8217;d be 1615, &lt;span class="caps"&gt;MST&lt;/span&gt; is 1715, and &lt;span class="caps"&gt;PST&lt;/span&gt; is 1815. You can refer to the following time conversions site to determine other times if you&amp;#8217;re not familiar with this&amp;#8230;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://tycho.usno.navy.mil/zones.html"&gt;http://tycho.usno.navy.mil/zones.html&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Matt Burden commented</title>
      <author>Matt Burden</author>
      <pubDate>Tue, 21 Jul 2009 15:03:12 +0000</pubDate>
      <link>http://forums.shopify.com/categories/2/posts/28101#comment-28299</link>
      <guid>http://forums.shopify.com/categories/2/posts/28101#comment-28299</guid>
      <description>&lt;p&gt;Thanks, that worked.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
