- Working with QlikView
- Script syntax and chart functions
- Functions in scripts and chart expressions
- Date and time functions
- setdateyear - script and chart function
setdateyear - script and chart function
This function takes as input a timestamp and a year and updates the timestamp with the year specified in input.
Syntax:
setdateyear (timestamp, year)
Return data type: dual
Arguments:
Argument | Description |
---|---|
timestamp | The date to evaluate as a timestamp or expression resolving to a timestamp, to convert, for example '2012-10-12'. |
year | A four-digit year. |
These examples use the date format DD/MM/YYYY. The date format is specified in the SET DateFormat statement at the top of your load script. Change the format in the examples to suit your requirements.
Example | Result | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setdateyear ('29/10/2005', 2013) | Returns ' |
||||||||||||||||||||||||||||
setdateyear ('29/10/2005 04:26:14', 2013) |
Returns ' |
||||||||||||||||||||||||||||
Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result. SetYear: Load *, SetDateYear(testdates, 2013) as NewYear Inline [ testdates 1/11/2012 10/12/2012 1/5/2013 2/1/2013 19/5/2013 15/9/2013 11/12/2013 2/3/2014 14/5/2014 13/6/2014 7/7/2014 4/8/2014 ]; |
|