Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveosoule/8760e4d3f8e167844345 to your computer and use it in GitHub Desktop.
Save steveosoule/8760e4d3f8e167844345 to your computer and use it in GitHub Desktop.
Miva - MivaScript Formatted Date Timestamp
<mvt:assign name="g.current_time" value="s.time_t" />
<mvt:assign name="g.timezone_offset" value="'local'" />
<mvt:comment><!-- <mvt:assign name="g.timezone_offset" value="'-4'" /> --></mvt:comment>
<mvt:comment>
| Format Date
| /lib/util_soap.mv
| <MvFUNCTION NAME = "Format_SOAP_DateTime" PARAMETERS = "time_t" STANDARDOUTPUTLEVEL = "">
</mvt:comment>
<mvt:do file="g.Module_Library_Utilities" name="g.Format_SOAP_DateTime" value="Format_SOAP_DateTime( g.current_time )" />
&mvte:global:Format_SOAP_DateTime; <!-- 2019-03-22T16:02:46Z -->
<!--
OR
-->
<mvt:assign name="g.year" value="time_t_year( g.current_time, g.timezone_offset )" />
<mvt:assign name="g.month" value="padl(time_t_month( g.current_time, g.timezone_offset ), 2, 0)" />
<mvt:assign name="g.day" value="padl(time_t_dayofmonth( g.current_time, g.timezone_offset ), 2, 0)" />
<mvt:assign name="g.24hour" value="padl(time_t_hour( g.current_time, g.timezone_offset ), 2, 0)" />
<mvt:assign name="g.min" value="padl(time_t_min( g.current_time, g.timezone_offset ), 2, 0)" />
<mvt:assign name="g.sec" value="padl(time_t_sec( g.current_time, g.timezone_offset ), 2, 0)" />
<mvt:assign name="g.formatted_date" value="g.year $ '-' $ g.month $ '-' $ g.day $ ' ' $ g.24hour $ ':' $ g.min $ ':' $ g.sec" />
&mvt:global:formatted_date; <!-- 2019-03-22 09:02:46 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment