Date/time tag extensions
Date/Time tag extensions provide a way of formatting date and time values. Date/Time tag extensions are currently only available for tags where this is explicitly stated.
Some Dynamicweb modules allow date and time tags to be extended, providing alternate date/time formats.
The extension is added to the normal tag name as exemplified below:
The tag <!--@DWCalendar:Event:Date--> returns the date value "03/20/2006".
The extended date tag <!--@DWCalendar:Event:Date.Year--> returns "2006".
The extended tags are not available in the Razor context. @GetValue() returns the value as an object of the specific type, and if used as is applied with a ToString and will fall back to the returned objects ToString method. When working with dates, use the @GetDate() method which returns a DateTime object and use the date properties and date formatting methods available in .NET to format to the proper date strings. See http://msdn.microsoft.com/enus/library/system.datetime.aspx.
An example using GetDate and .NET date formatting:
Date extension tags are not available in Razor templates. Use @GetDate() and .NET date formatting instead.
Extensions
The following date/time tag extensions are available wherever indicated:
Extension | Description |
*.Day | Returns the day of the month. (1-31) |
*.LongDayName | Returns the name of the day. (E.g. Monday) |
*.ShortDayName | Returns the short name of the day. (E.g. Mon) |
*.Hour | Returns the hour part of the time. (0-23) |
*.Minute | Returns the minute part of the time. (0-59) |
*.Second | Returns the second part of the time. (0-59) |
*.Month | Returns the month part of the date as numeric value. (1-12) |
*.LongMonthName | Returns the full name of the month. (E.g. March) |
*.ShortMonthName | Returns the short name (3 letters) of the month (E.g. Mar) |
*.Year | Returns the year part of the date. (E.g 2006) |
*.Weekday | Returns the numeric representation of the day of the week. (1-7) |
*.WeekOfYear | Returns the week number of the year. (1-53) |
*.DayOfYear | Returns the day number of the year. (1-366) |
*.Quarter | Returns the quarter number of the year. (1-4) |
*.GeneralDate | Returns the date in the general format. |
*.LongDate | Returns the date using the long date format. |
*.LongTime | Returns the time using the time format: hh:mm:ss PM/AM |
*.MediumDate | Returns the date using the medium date format. |
*.ShortDate | Returns the date using the short date format. |
*.ShortTime | Returns the time using the 24-hour format: hh:mm |
*.Sortable | Returns the date using a defined standard (ISO 8601). It is always the same, regardless of the culture used or the format provider supplied. The format string is yyyy-mm-ddThh:mm:ss (E.g. 2011-06-20T12:28:05). |
*.SortableOffset |
Returns the date using a defined standard (ISO 8601). It is always the same, regardless of the culture used or the format provider supplied - relative to UTC. The format string is yyyy-mm-ddThh:mm:ss+/-hh:mm (E.g. 2011-06-20T12:28:05+02:00). |
*.RFC1123 | Returns the date using the RFC1123 format. (E.g. Thu, 06 Apr 2006 09:30:00 GMT) |