"time" Snippets


Basket #28566

Created: 1480611215
View "Basket #28566"
<mvt:assign name="g.timestamp" value="s.dyn_time_t" /> <mvt:assign name="g.timezone_offset" value="g.Merchant_Local_Timezone" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> Local Timezone = &mvt:global:formatted_date;<br> <mvt:if expr="g.year EQ 2016 AND g.month EQ 12 AND g.day EQ 02"> <mvt:assign name="g.dec1" value=" 'Today is the first.' " /> <mvt:elseif expr="g.year EQ 2016 AND g.month EQ 12 AND g.day EQ 01"> <mvt:assign name="g.dec2" value=" 'Today is the second.' " /> </mvt:if> <mvt:if expr="g.dec1"> Show banner for the first. <mvt:elseif expr="g.dec2"> Show banner for the second. </mvt:if>
 

Basket #28565

Created: 1480611198
View "Basket #28565"
<mvt:assign name="g.timestamp" value="s.dyn_time_t" /> <mvt:assign name="g.timestamp" value="1461778886" /> <mvt:assign name="g.timezone_offset" value="g.Merchant_Local_Timezone" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> Merchant_Local_Timezone = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-3'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -3 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-4'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -4 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-5'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -5 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'local'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> local = &mvt:global:formatted_date;<br>
 

Basket #18686

Created: 1467209265
View "Basket #18686"
<mvt:assign name="g.timestamp" value="s.dyn_time_t" /> <mvt:assign name="g.timezone_offset" value="g.Merchant_Local_Timezone" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> Merchant_Local_Timezone = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-3'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -3 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-4'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -4 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-5'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -5 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'local'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> local = &mvt:global:formatted_date;<br>
 
View "Dates & Times with Various Timezone Methods"
<mvt:assign name="g.timestamp" value="s.dyn_time_t" /> <mvt:assign name="g.timestamp" value="1461778886" /> <mvt:assign name="g.timezone_offset" value="g.Merchant_Local_Timezone" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> Merchant_Local_Timezone = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-3'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -3 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-4'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -4 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'-5'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> -5 = &mvt:global:formatted_date;<br> <mvt:assign name="g.timezone_offset" value="'local'" /> <mvt:assign name="g.year" value="time_t_year( g.timestamp, g.timezone_offset )" /> <mvt:assign name="g.month" value="padl(time_t_month( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.24hour" value="padl(time_t_hour( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.min" value="padl(time_t_min( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.sec" value="padl(time_t_sec( g.timestamp, g.timezone_offset ), 2, 0)" /> <mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" /> local = &mvt:global:formatted_date;<br>
 

Asset Cache Buster

 file  time
Use [MivaScript's stime() function](http://www.mivascript.com/item/stime.html) to add a cache-busting parameter to a [style sheet](http://snippets.miva.com/assets/css/main.css). The time returned will be the last time the file was modified, thus making sure users always view the latest version.
Created: 1432324035
View "Asset Cache Buster"
<link rel="stylesheet" href="/assets/css/main.css?v=<mvt:eval expr="stime('/assets/css/main.css')"/>"> <mvt:comment> <!-- Checks the last time this file was modified: http://snippets.miva.com/assets/css/main.css And outputs: <link rel="stylesheet" href="/assets/css/main.css?v=1427216581"> MivaScript's stime() function works a lot like PHP's filemtime() --> </mvt:comment>
 

Asset Cache Buster

 file  time
Use MivaScript's stime () to add a cache-busting parameter to a style sheet. The time returned will be the last time the file was modified, thus making sure users always view the latest version.
Created: 1432323720
View "Asset Cache Buster"
<link rel="stylesheet" href="/assets/css/main.css?v=<mvt:eval expr="stime('/assets/css/main.css')"/>">