Page d'assistance WaihonaPedia

Macro: makeNiceDate


Macro for changing a string value date from a class object (even if it's encapsulated in a HTML macro) to an arbitrary made up date Object.

Inline use:
{{makeNiceDate
  fieldName='[Class attribute name, example 'dateFrom']'
  formatOut='[Date format, standard set to 'd MMM YYYY']'
  className='[Class name, example: 'testCode.testClass']'
  objectName='[Name of the object that contains the date, example 'test.test1']'
/}}

Date formatting

The specified format may be a standard style pattern ('full', 'long', 'medium', 'short', or 'default'). You may also specify that you want only the date or time portion be appending '_date' or '_time' respectively to the standard style pattern (e.g. 'full_date' or 'long_time'). If the format fits neither of these patterns, then the output will be formatted according to the symbols defined by SimpleDateFormat:

Symbol   Meaning                 Presentation        Example


G        era designator          (Text)              AD
y        year                    (Number)            1996

M        month in year           (Text & Number)     July & 07
d        day in month            (Number)            10
h        hour in am/pm (112)     (Number)            12
H        hour in day (023)       (Number)            0
m        minute in hour          (Number)            30
s        second in minute        (Number)            55
S        millisecond             (Number)            978
E        day in week             (Text)              Tuesday
D        day in year             (Number)            189
F        day of week in month    (Number)            2 (2nd Wed in July)
w        week in year            (Number)            27
W        week in month           (Number)            2
a        am/pm marker            (Text)              PM
k        hour in day (124)       (Number)            24
K        hour in am/pm (011)     (Number)            0
z        time zone               (Text)              Pacific Standard Time
'        escape for text         (Delimiter)
''       single quote            (Literal)           '

Examples:

  • "E, MMMM d" will result in "Tue, July 24"
  • "EEE, M-d (H:m)" will result in "Tuesday, 7-24 (14:12)"
     

À propos du contenu du site Web

Toutes les informations contenues dans ce site Web sont uniquement destinées à des fins éducatives. Pour obtenir des conseils, des diagnostics et des traitements médicaux spécifiques, adressez-vous à votre médecin. L'utilisation de ce site est strictement à vos propres risques. Si vous trouvez quelque chose qui, selon vous, nécessite une correction ou une clarification, veuillez nous en faire part à l'adresse suivante : 

Envoyez un courriel : info@cdlsWorld.org