AddMinutes

AddMinutes

Adds a specified number of minutes to a date.

Namespace

xmlns:AS="http://schema.advantages.cz/AsapFunctions"

Syntax

string AddMinutes(string date, string minutes)

Parameters

Name Description
date Date to which minutes will be added.
minutes Number of minutes to add (if negative, minutes will be deducted).

Remarks

Seconds and smaller parts will not be touched.

Example

This example adds 1 minute to a source date.

Source XML

<ROOT>
    <test date="2012-03-23T16:00:00"/>
</ROOT>

Comment

When date is formated 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:AddMinutes(/ROOT/test/@date, 1)}"/>
    </xsl:template>
</xsl:stylesheet>