Adds a specified number of hours to a date.
NAMESPACE
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
SYNTAX
string AddHours(string date, string hours)
PARAMETERS
Name | Description |
---|---|
date | Date to which hours will be added. |
hours | Number of hours to add (if negative, hours will be deducted). |
REMARKS
Minutes and smaller parts will not be touched.
EXAMPLE
This example adds 1 hour to a source date.
Source XML
<ROOT>
<test date="2012-03-23T16:00:00"/>
</ROOT>
COMMENT
When date is formatted by the help of AS:FormatDate
- have in mind that yyyy-MM-ddThh:mm:ss
is 12-hour format and yyyy-MM-ddTHH:mm:ss
is 24-hour format. More info about date formats can be found here.
Stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="AS date">
<xsl:template match="/">
<test test="{AS:AddHours(/ROOT/test/@date, 1)}"/>
</xsl:template>
</xsl:stylesheet>