Date and Time functions perform different basic actions on input data, such as extracting the day/month/year from a date, adding years to a certain date etc.
Supported Date and Time functions:
• | Now - returns the current date and time, according to the local machine's time |
This functions has only one output parameter, that is, the current date and time.
The following example returns the current date and time.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2012-09-27T17:33:58Z" xmlns:ns="http://www.tempuri.org/XML"/>
• | UtcNow - return the current date and time, according to the local machine's time, the selected time zone and the Daylight Saving |
This functions has only one output parameter, that is, the current UTS date and time.
The following example returns the current UTC date and time.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2012-09-27T14:36:13Z" xmlns:ns="http://www.tempuri.org/XML"/>
• | DateDiff - returns the number of ticks between the 2 input dates (Note: 1 tick = 0.1 seconds) |
This function has as input parameters the two days that will be compared and returns through the ticks output parameter the difference between the two dates (in ticks).
The following example returns the number of ticks between the dates.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="3826632704" xmlns:ns="http://www.tempuri.org/XML"/>
• | Day - returns the day from a given input date |
This function has as input parameter the date which's day will be returned.
The following example will return "12".
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="12" xmlns:ns="http://www.tempuri.org/XML"/>
• | Month - returns the month from a given input date |
This function has as input parameter the date which's month will be returned.
The following example will return "7".
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="7" xmlns:ns="http://www.tempuri.org/XML"/>
• | Year - returns the year from a given input date |
This function has as input parameter the date which's year will be returned.
The following example will return "2012".
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2012" xmlns:ns="http://www.tempuri.org/XML"/>
• | Add Ticks - adds ticks to the input time |
This function has two input parameters: the date and the number of ticks to be added to the date.
The following example adds 36000 ticks to the input day and time, that is, 36 seconds.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2012-07-12T00:00:36Z" xmlns:ns="http://www.tempuri.org/XML"/>
• | Add Days - adds days to the input date |
This function has two input parameters: the date and the number of days to be added to the date.
The following function adds 3 days to the current date (the 12th of July 2012).
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2012-07-15T00:00:00Z" xmlns:ns="http://www.tempuri.org/XML"/>
• | Add Months - adds months to the input date |
This function has two input parameters: the date and the number of months to be added to the date.
The following function adds 3 months to the current date (the 12th of July 2012).
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2012-10-12T00:00:00Z" xmlns:ns="http://www.tempuri.org/XML"/>
• | Add Years - adds years to the input date |
This function has two input parameters: the date and the number of years to be added to the date.
The following function adds 3 years to the current date (the 12th of July 2012).
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="2015-07-12T00:00:00Z" xmlns:ns="http://www.tempuri.org/XML"/>
• | To String - converts a date to string |
This function has two input parameters: the input date and its format.
The following function converts the current date (the 12th of July 2012) to string.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root attribute-name="12/7/2012" xmlns:ns="http://www.tempuri.org/XML"/>
Supported date formats:
• | d/M/yyyy |
• | dd/M/yyyy |
• | d/MM/yyyy |
• | dd/MM/yyyy |
• | d-M-yyyy |
• | dd-M-yyyy |
• | d-MM-yyyy |
• | dd-MM-yyyy |
• | and reversed (eg: yyyy/MM/dd, yyyy-M-dd, etc) |
Supported time format:
• | hh:mm:ss |
An option would be to use the Convert to Date function (located in the Conversion Functions group) and transform the date to the conventional format.