Newscoop 4 Cookbook

Date and e-mail formatting

Date Formatting

The "camp_date_format" modifier formats a date string as specified:

{{ <string>|camp_date_format:"<date_attribute>" }} 
{{ <string>|camp_date_format:"<date_format>" }} 

Filters:

<date_attribute> may be one of the following:

  • year: year (four digits)
  • mon: month as a number (1..12)
  • mday: day of the month as a number (1..31)
  • yday: day of the year (1..366)
  • wday: day of the week as a number (0=Sunday..6=Saturday)
  • hour: hour (0..23)
  • min: minute (two digits)
  • sec: seconds (two digits)
  • mon_name: name of the month
  • wday_name: day of the week

<date_format> may contain any printable character; escape " (double quotes) in the date formatting with \ (backslash). For example: "%M %e, %Y, \"%W\"" will display the the date like this: July 5, 2008, "Saturday".

The following groups of characters have special meaning:

  • %M - month name
  • %W - weekday name
  • %Y - year (4 digits)
  • %y - year (2 digits)
  • %m - month (01..12)
  • %c - month (1..12)
  • %w - day of the week (0=Sunday..6=Saturday)
  • %d - day of the month (00..31)
  • %e - day of the month (0..31)
  • %j - day of the year (001..366)
  • %D - day of the month with English suffix (1st, 2nd, 3rd etc.)
  • %H - hour in format 00..23
  • %h - hour in format 01..12
  • %l - hour in format 1..12
  • %i - minutes in format 00..59
  • %S - seconds in format 00..59
  • %s - is an alias of %S
  • %p - AM or PM

Constraints:

None

Email Obfuscation

The "obfuscate_email" modifier obfuscates a string; the email string is obfuscated to prevent spambot web crawlers from finding it.

{{ <email_string>|obfuscate_email }}