Set first, then output
The time details come from a point in time that you define at the beginning.DC-DateTime_set() does this.
Setting a different point in time
DC-DateTime_set() accepts an offset in seconds. You use it to calculate into a different time zone or into the future.
DC-DateTime_setunixtimestamp() instead sets an absolute point in time. The argument supports tag-in-tag, so the point in time can come from another tag.
If the argument is empty or not a number, the shop sets the point in time to now. An incorrect value therefore does not lead to a wrong date from the year 1970, but to the current server time.
DC-DateTime_unixtimestamp outputs the point in time just set as a UNIX timestamp. This is useful for passing it to a third-party system or to JavaScript. The tag is not described in the previous documentation, but it exists in the shop.Outputting the components
Leading zeros
By default, the numbers come without a leading zero. The argumenttrue switches it on.
DC-DateTime_year() does not make this distinction and always outputs four digits. An argument has no effect there.Switching areas by time
All components can be bracketed. The area appears if the value matches the argument.The day of the week
As a range tag,DC-DateTime_dayofweek() accepts a comma-separated list of days of the week.
Only the first three characters are compared, and upper and lower case do not matter.
{DC-DateTime_dayofweek(Monday)} therefore applies just like {DC-DateTime_dayofweek(mon)}. Nevertheless, stick to the abbreviation so that it is clear in the template what the tag actually compares.Measuring runtimes
DC-Timer1…3 measures how long the shop takes for a section of the template. Three independent timers are available.
A useful pattern: timer 1 encloses the entire template and returns the total duration, while the other two narrow down the suspicious sections.
Overview of the tags
All tags are permitted in all templates, except for the timers, which do not measure in include files.
Related topics
- Reference: DC- (comparisons and other tags)
- Reference: DC- (free parameters and session parameters)
- Basics: Tag basics
