0 users online. Create an account or sign in to join them.Users



I used current-time to display the local time. Because of a move to a different time zone I need to add an extra hour to the output. Can’t remember how his can be done…


You can use the EXSLT library to manipulate dates: dates and times

First import the EXSLT date-time namespace to your stylesheet:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">

Then something like:

<xsl:value-of select="date:add($today, 'P1D')"/>

The add function accepts a date in ISO format (which the $today parameter provides), plus a “duration”. Durations are expressed in a specific format. In this instance is is P followed by the duration, in this case one day 1D.

This should output:


Oh! You wanted one hour, not one day. In this case add the time to the mix too:

<xsl:value-of select="date:add(concat($today,'T',$current-time,':00'), 'PT1H')"/>

Concatenate the date and time together to form an ISO-format date in the form:


Then add T to the duration format (signifying you’re specifying time) and use H for hours.

Thanks Nick for the info… will give it a try

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details