• Login
  • login to access premium content (it's free).

Date Manipulation

moment - Date Formatting

Check out moment.js. The Easiest way to display formatted dates with Javascript.

I liked this so much I wanted to be able to use it within the HTML/OS environment, so I developed the display portion of moment to work in html/os.

HTML/OS Moment is part of a larger project that exposes powerful templating to end users without risk of exposing your HTML/OS programming environment. Interested, send me an email.

Here are the same examples from momentjs.com

moment(now,'MMMM Do YYYY, h:mm:ss a') 
April 25th 2024, 8:35:35 pm
moment(now,'dddd')
Thursday
moment(now,'MMM Do YY')
Apr 25th 24
moment(now,'YYYY [escaped] YYYY notescaped')
2024 escaped 2024 note35cpmpe5

Moment is brand new and has plenty of room to grow. If you need a particular feature email me and we can talk.

If you are already an Image Services user you can upgrade to the latest for moment functionality.

shift - date math

Shift is used to move a date around. It takes an Aestiva date, and returns an Aestiva date. The unitordinal and the amount work together to manipulate the date. The unitordinal can be something like 'month' this would indicate that the amount will be by month. It can also be an implied unit. For example if the unitordinal is 'Tuesday' then it is implied the unit is 'week', so we will be adding by week and we will shift to 'tuesday' of the returned week.

SHIFT(DATE,UNITORDINAL,AMOUNT)

UNIT        UNITORDINAL
----------- -----------

MONTH       month
            1st         day 1 in the month
            2nd         day 2 in the month
            3rd etc...
            31st        day 31 in month or last day in month
            endofmonth  last day in month

            example: shift('11/01/2011','endofmonth',2) = '01/31/2012'

WEEK        week
            Sunday
            Monday
             etc...
            Saturday

            example: shift('10/01/2014','week',-2) = '09/17/2014'
                     shift('10/01/2014','Sunday',0) = '09/28/2014'

DAY         day
            example: shift('03/12/2012','day',20) = '04/01/2014'

YEAR        year
            endofyear
            day1        first day of the year
            day2        second day of the year
             etc...
            day365      365th day of the year
            day366      Synonymn of endofyear

            example: shift('09/21/2000','year',5)

Here is the Code