Welcome

BoltWire is a content management system developed by Dan Vis.

Welcome Tour
Documentation
Mailing List



Popular Posts

Version 5.11 Released
May 26, 2016

Big Changes Coming Soon...
April 28, 2016

Catching Up
April 6, 2016



Other Sites

Here's some other sites by Dan Vis:

Alexa Echoes
Join my adventures developing for Amazons exciting new voice platform.

Firefly Spot
Personal rambling about new gadgets, technology news, and space travel.

FAST Missions
My ministry hub, with news and updates about our online school.

You can follow him at www.danvis.info.

Time

Documentation > Concepts > Time

BoltWire's time function/command taps directly into both the strtotime and strftime functions in PHP (strtotime allows you to enter time values like "Tomorrow" or " 3 hours" and it will automatically convert it to the appropriate timestamp; strftime allows you to take that timestamp and display it in various formats, as desired).

Listed below are some of the possible formatting options -- though the output of some will vary from server to server depending on your PHP configuration. For a complete discussion, please refer to the PHP manual.

SyntaxMeaningOutput Sample
[(time {now} "%A")] Weekday Friday
[(time {now} "%a")] Weekday Short Fri
[(time {now} "%B")] Month Name October
[(time {now} "%b")] Month Name ShortOct
[(time {now} "%c")] Date and TimeFri Oct 20 14:47:41 2017
[(time {now} "%d")] Day of Month 01-3120
[(time {now} "%H")] Hour 00-24 14
[(time {now} "%I")] Hour 00-12 02
[(time {now} "%M")] Minute 47
[(time {now} "%m")] Month 01-12 10
[(time {now} "%S")] Second 41
[(time {now} "%U")] Week number, starting from the first Sunday 42
[(time {now} "%W")] Week number, starting from the first Monday 42
[(time {now} "%w")] Weekday, Sunday being 05
[(time {now} "%X")] WhatTimeIsIt 14:47:41
[(time {now} "%x")] WhatDayIsIt 10/20/17
[(time {now} "%Y")] Year 2017
[(time {now} "%y")] Year Short17
[(time {now} "%Z")] Time zone CDT
[(time {now} "%Y %y %m%d %H:%M:%S")] Mix 2017 17 1020 14:47:41
[(time {now} "%Y-%m-%d")]International date format2017-10-20

Examples

Here is a simple snippet illustrating the new, very powerful, time command. Try entering a time string like "tomorrow" or " 2 months", or a format like "%c" or %x", or both, with a pipe in the middle, like "today|%x". For more details see php documentation for the strtotime and strftime functions.


[form]
[text time][submit]
[command warn "{=time}"]
[form]

Here is something perhaps more useful. Suppose you need a timestamp (e.g. for an unique url of the page you create) and want also store this same timestamp in another format (e.g. human readable to display) as a data value, you can do this in your form:


[form]
Timestamp: [text when {now}]
[submit]
[command target "examplepage.{=when}"]
[command time "{=when}|%m/%d/%Y"]
[command savedata time]
[form]

Of course {:time} could be produced just as easily by saving when and doing [(time {:when} '%m/%d/%Y')].

Here are some ways to handle due dates:


Days until next year: [(time "Jan 1, 2010" due)] days.

Tomorrow starts in: [(time "tomorrow" due=3600)] hours.

Days until next year: Fri Jan 1 00:00:00 2010 days.

Tomorrow starts in: Sat Oct 21 00:00:00 2017 hours.


International


If you want to change the time output to your local environment, try add the following line to your index.php file before including the engine (here for Germany):

setlocale (LC_TIME,'de_DE');

To leave a comment, please login using your Facebook account: