Skip to main content

Posts

Showing posts from July, 2019

Add/Delete Hours/Minutes in Xquery

Hi, Recently i came up with a requirement where due to different timezone we have to send received date with 4 hour difference, We tried same thing to control in XSLT but in that case we have to write one XSLT template which will handle it. Yes that work for us as we need to handle time part only, in-respect of what's going to be happen with Date but for feature we must be prepared to handle date also, so we come up with some pre-defined xquery function who will take care our this timezone issue. Subtract minutes from date. {xs:dateTime(runTs)  -  xs:dayTimeDuration("PT15M")} Subtract hours from date {xs:dateTime(runTs)  -  xs:dayTimeDuration("PT4H")} Add hours in date {xs:dateTime(runTs)  + xs:dayTimeDuration("PT4H")} Add minutes in date. {xs:dateTime(runTs)  +  xs:dayTimeDuration("PT15M")} Sample Test case: 4 Hours subtract from input dateTime  Input:   <runTs>2019-07-02T03:18:15.3