
MarkLogic 12 Product Documentation
sql:timestampaddsql:timestampadd(
   $dateTimeType as xs:ID,
   $value as xs:integer,
   $timestamp as xs:string
) as xs:integer?
Summary
  Returns a xs:string? timestamp created by adding a number to the given dateTimeType field of a given timestamp.
	  
	  
	
	  
	    | Parameters | 
	  
	
	  
	    | dateTimeType | 
	    
  The dateTimeType of the timestamp where addition should take place. Available types are:
  
  SQL_TSI_FRAC_SECOND  
  - nano seconds
 
  SQL_TSI_SECOND  
  - seconds
 
  SQL_TSI_MINUTE  
  - minute
 
  SQL_TSI_HOUR  
  - hour
 
  SQL_TSI_DAY  
  - day
 
  SQL_TSI_WEEK  
  - week
 
  SQL_TSI_MONTH  
  - month
 
  SQL_TSI_QUARTER  
  - quarter
 
  SQL_TSI_YEAR  
  - year
 
   
   | 
	  
	  
	    | value | 
	    
  The integer to add to the given dateTimeType field of the third parameter.
   | 
	  
	  
	    | timestamp | 
	    
  The xs:dateTime timestamp to which addition has to take place.
   | 
	  
	
Example
xdmp:sql("select timestampadd(SQL_TSI_DAY, 2,'2009-05-18T03:03:03')","format")
=> |ANON7761991471377004207| |2009-05-20T03:03:03|
Example
sql:timestampadd('SQL_TSI_DAY', 2,'2009-05-18T03:03:03')
=> |ANON7761991471377004207| |2009-05-20T03:03:03|
    Copyright © 2025 MarkLogic Corporation. MARKLOGIC is a
    registered trademark of MarkLogic Corporation.