{"id":4045,"date":"2017-09-22T21:36:20","date_gmt":"2017-09-23T04:36:20","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=4045"},"modified":"2025-06-13T23:43:22","modified_gmt":"2025-06-14T06:43:22","slug":"dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/","title":{"rendered":"Oracle Date Format: N1QL and Support for Date-Time Functions"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Date and Time functions and formats can vary for different databases. In this article, we shall compare Couchbase ISO-based Date-Time functions with Oracle Date format. Date formats vary between relational and NoSQL database due to the nature of NoSQL JSON formats. Learn more <a href=\"https:\/\/resources.couchbase.com\/c\/vid-gain-flexibility-of-nosql?x=S3S4iI\">in this webcast<\/a> about how to avoid sacrificing your SQL knowledge while also <a href=\"https:\/\/resources.couchbase.com\/c\/vid-gain-flexibility-of-nosql?x=S3S4iI\">maintaining flexibility in your NoSQL database queries<\/a>.<\/span><\/p>\n<h2>Oracle date\/time types<\/h2>\n<p><span style=\"font-weight: 400\">In Oracle, the <em>date<\/em> format and the <em>time zone<\/em> features include multiple data types, including: <em>DATE<\/em>, <em>TIMESTAMP<\/em>, <em>TIMESTAMP WITH TIME ZONE<\/em> and <em>TIMESTAMP WITH LOCAL TIME ZONE<\/em>. The <em>TIMESTAMP<\/em> data type is an extension of the <em>DATE<\/em> type. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Date format in Oracle can be represented either as <strong>literals<\/strong> or as <strong>numeric<\/strong> values. The literal needs to be in a specified format. The format for the date-times can be set using the <em>NLS_DATE_FORMAT<\/em>, <em>NLS_TIMESTAMP_FORMAT<\/em>, <em>NLS_TIMESTAMP_TZ_FORMAT<\/em> and the <em>NLS_DATE_LANGUAGE<\/em> parameters. The table, below, presents a detailed comparison with working examples.<\/span><\/p>\n<h2>Couchbase date formats<\/h2>\n<p><span style=\"font-weight: 400\">With Couchbase, Date-Time is done a little differently. All dates and times should be stored as <strong>strings<\/strong> that follow the <strong>Extended ISO 8601 date time format<\/strong>. N1QL contains <em>DATETIME<\/em> functions that can be used to and extract these Oracle date formatted strings. The <em>DATE<\/em> and <em>TIME<\/em> for a specific timezone can also be represented as a Unix timestamp in milliseconds. <\/span><\/p>\n<p><span style=\"font-weight: 400\">This essentially means that, unlike Oracle, where the format of the input date and time can change based on the values of the <em>NLS_DATE_FORMAT<\/em> and <em>NLS_TIMESTAMP_FORMAT<\/em>, the format for dates in Couchbase follows a strict set.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">For example, in Oracle timestamp format:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em>&#8216;2008-DEC-25 17:30&#8217;<\/em> is a valid date given the <em>NLS_DATE_FORMAT=&#8217;YYYY-MON-DD HH24:MI&#8217;<\/em><\/p>\n<p><span style=\"font-weight: 400\">However, to represent the same value in Couchbase the user needs to use one of the given <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/datefun.html\">date function formats<\/a>.<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">For example, 2008-12-25 17:30:00<\/span><\/em><\/p>\n<h3>Time precision<\/h3>\n<p><span style=\"font-weight: 400\">In Oracle, <\/span><em><span style=\"font-weight: 400\">fractional_seconds_precision<\/span><\/em><span style=\"font-weight: 400\"> is optional and specifies the number of digits in the fractional part of the <em>SECOND<\/em> datetime field. It can be a number (0-9) with the default being 6.<\/span><\/p>\n<p><span style=\"font-weight: 400\">For example, in Oracle the date-time format can be given as:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">TIMESTAMP &#8216;YYYY-MM-DD HH24:MI:SS.FFF&#8217;<\/span> <\/em><\/p>\n<p><span style=\"font-weight: 400\">Using this we can define the timestamp to be: <\/span><em><span style=\"font-weight: 400\">&#8216;2006-01-02 15:04:05.999&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\"><a href=\"https:\/\/www.couchbase.com\/products\/n1ql\/\">Couchbase N1QL<\/a> supports fractional seconds similar to Oracle. This is seen when using the format:<\/span><span style=\"font-weight: 400\">\u00a0<em>&#8220;2006-01-02T15:04:05.999&#8221;<\/em>. <\/span><span style=\"font-weight: 400\">However,<\/span> <span style=\"font-weight: 400\">N1QL supports 3 digit precision (nanosecond precision) and Oracle supports up to 9 digit fractional second precision. <\/span><\/p>\n<p><span style=\"font-weight: 400\">This means that if we specify the date: <\/span><span style=\"font-weight: 400\"><em>&#8220;2006-01-02T15:04:05.999123456&#8221;<\/em>, N1QL will round off to 3 digits and return: <em>&#8220;2006-01-02T15:04:05.999&#8221;<\/em>.<\/span><\/p>\n<p><span style=\"font-weight: 400\">For N1QL, <\/span><\/p>\n<pre class=\"lang:default decode:true\" title=\"N1QL\">SELECT STR_TO_TZ(\"2006-01-02T15:04:05.999123456\", 'America\/Los_Angeles') as west;\r\n \u00a0\u00a0\u00a0\"results\": [\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"west\": \"2006-01-02T15:04:05.999\"\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n \u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">For Oracle,<\/span><\/p>\n<pre class=\"nums:false lang:default decode:true\">SELECT TO_TIMESTAMP('25-DEC-2008 01:00:00.336123456', 'dd-mon-yyyy hh:mi:ss.ff') as D from dual;\r\n\r\n&gt; D\r\n&gt; 2008-12-25 01:00:00.336123456<\/pre>\n<p><span style=\"font-weight: 400\">Using N1QL, If we specify a more than 9 digits, the Date-Time function returns null. <\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT STR_TO_TZ(\"2006-01-02T15:04:05.9991234567\", 'America\/Los_Angeles') as west;\r\n\u00a0\u00a0\u00a0\"results\": [\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"west\": null\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n \u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">For Oracle Date-Time format, if you give more than 9 digits for the fractional seconds part it throws an error: <\/span><em><span style=\"font-weight: 400\">ORA-01830: date format picture ends before converting entire input string<\/span><\/em><\/p>\n<h2>Comparison of Oracle and Couchbase date\/time approaches<\/h2>\n<p><span style=\"font-weight: 400\">A comparison of the Couchbase N1QL and Oracle&#8217;s date-time support is given in the following table:<\/span><\/p>\n<div class=\"responsive-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Oracle Date and Time datatypes<\/strong><\/td>\n<td><strong>Couchbase Date Time format support<\/strong><\/td>\n<\/tr>\n<tr>\n<td><em><span style=\"font-weight: 400\">DATE <\/span><\/em><span style=\"font-weight: 400\">data type f<\/span><span style=\"font-weight: 400\">ormat is defined by:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_DATE_FORMAT<\/span><\/em><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_DATE_LANGUAGE<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Example: <\/span><\/p>\n<p><span style=\"font-weight: 400\">The <em>NLS_DATE_FORMAT<\/em> parameter needs to be set <\/span><span style=\"font-weight: 400\">in the initialization parameter file:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_DATE_FORMAT=&#8217;YYYY-MON-DD&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Sample date:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">DATE &#8216;2008-DEC-25&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">To set the <em>NLS_DATE_LANGUAGE<\/em> parameter we <\/span><span style=\"font-weight: 400\">can use the <em>ALTER SESSION<\/em> statement.<\/span><\/p>\n<pre class=\"lang:default decode:true\">ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;\r\n\r\nSELECT TO_CHAR(SYSDATE, 'Day:Dd Month yyyy') \r\nFROM DUAL;\r\n\r\nTO_CHAR(SYSDATE,'DAY:DDMONTHYYYY')\r\n--------------------------------------\r\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">In N1QL there is no specific date\/time\/<\/span><span style=\"font-weight: 400\">timestamp data type. They are all represented by JSON strings with ISO 8601 extended formats and are manipulated using the date time manipulation and arithmetic functions. <\/span><\/p>\n<p><span style=\"font-weight: 400\">See the <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/datefun.html\"><span style=\"font-weight: 400\">documentation<\/span><\/a><span style=\"font-weight: 400\"> for complete list.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Allowed date format*:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">YYYY-MM-DD<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Example:<\/span><\/p>\n<pre class=\"lang:default decode:true\">{\r\n\u00a0\"Date\" : \"2008-12-25\"\r\n}<\/pre>\n<p><span style=\"font-weight: 400\">In Couchbase\/N1QL dates need to be represented in specific formats with day, month and year in numeric form. <\/span><\/p>\n<p>For all dates that do not match the input formats, we return the input date in the default format:<\/p>\n<p style=\"padding-left: 40px\"><em>YYYY-MM-DDThh:mm:ss.sTZD<\/em><\/p>\n<p><span style=\"font-weight: 400\">Use the <em>DATE_FORMAT_STR<\/em> function to convert the date format from <em>YYYY-MM-DD<\/em> to <\/span><span style=\"font-weight: 400\"><em>&#8216;YYYY-MON-DD&#8217;<\/em>\u00a0<\/span><\/p>\n<pre class=\"lang:default decode:true\">select date_format_str('2008-12-25',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'1111-DEC-12') D;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": \"2008-12-25T00:00:00-08:00\"\r\n\u00a0\u00a0\u00a0\u00a0}\r\n]\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Couchbase supports only <strong>ISO Extended date formats<\/strong>. It doesn&#8217;t support non-numeric dates in multiple languages.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"><em>TIMESTAMP<\/em> data type f<\/span><span style=\"font-weight: 400\">ormat is defined by:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_TIMESTAMP_FORMAT<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">You can specify the value of <\/span><em><span style=\"font-weight: 400\">NLS_TIMESTAMP_FORMAT<\/span><\/em><span style=\"font-weight: 400\"> by setting it in the initialization parameter file. <\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_TIMESTAMP_FORMAT \u00a0= &#8216;YYYY-MM-DD HH:MI:SS.FF&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">We can use the <em>TO_TIMESTAMP<\/em> function to convert input <em>date-time<\/em> to <em>timestamp<\/em> data type.<\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT \r\nTO_TIMESTAMP('25-DEC-2008 01:00:00.336', \r\n'dd-mon-yyyy hh:mi:ss.ff') from dual;\r\n\r\nTO_TIMESTAMP('25-DEC-200801:00:00.336',\r\n'DD-MON-YYYYHH:MI:SS.FF')\r\n---------------------------------\r\n2008-12-25 01:00:00.336<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">Same functions as date but with a different input date format input argument. This needs to be explicitly provided.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">The date format along with timestamp components:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">YYYY-MM-DD hh:mm:ss<br \/>\n<\/span><\/em><em><span style=\"font-weight: 400\">YYYY-MM-DDThh:mm:ss<br \/>\n<\/span><\/em><em><span style=\"font-weight: 400\">YYYY-MM-DD hh:mm:ss.s<br \/>\n<\/span><\/em><em style=\"font-family: inherit;font-size: inherit\">YYYY-MM-DDThh:mm:ss.s<\/em><\/p>\n<p><span style=\"font-weight: 400\">Time based formats:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">hh:mm:ss<br \/>\n<\/span><span style=\"font-weight: 400\">Hh:mm:ss.s<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Couchbase supports nanosecond precision.<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\ndate_format_str('2008-12-25T01:00:00.336', \r\n'1111-DEC-12 01:00:00.00') D;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": \"2008-12-25T01:00:00.336-08:00\"\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Data types:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">TIMESTAMP WITH TIMEZONE<br \/>\n<\/span><\/em><em><span style=\"font-weight: 400\">TIMESTAMP WITH LOCAL TIME ZONE<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Format defined by:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_TIMESTAMP_TZ_FORMAT<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">You can specify the value of <\/span><em><span style=\"font-weight: 400\">NLS_TIMESTAMP_TZ_FORMAT<\/span><\/em><span style=\"font-weight: 400\"> by setting it in the initialization parameter file:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">NLS_TIMESTAMP_TZ_FORMAT \u00a0= &#8216;YYYY-MM-DD HH:MI:SS.FF TZH:TZM&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">We can use the <em>TO_TIMESTAMP_TZ<\/em> function to convert input date-time to timestamp with time zone data type. It will maintain the input time zone.<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT TO_CHAR(TO_TIMESTAMP_TZ\r\n('2008-12-25, 01:00:00.336 -08:00', \r\n'yyyy-mm-dd hh:mi:ss.ff TZR')) FROM DUAL;\r\n\r\nTO_CHAR(TO_TIMESTAMP_TZ\r\n('2008-12-25,01:00:00.336-08:00',\r\n'YYYY-MM-DDHH:MI:SS.FFTZR'))\r\n--------------------------------------\r\n25-DEC-08 01.00.00.336000000 AM -08:00<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">Includes the DateTime components of format:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">YYYY-MM-DDThh:mm:ssTZD<br \/>\n<\/span><span style=\"font-weight: 400\">YYYY-MM-DD hh:mm:ssTZD<br \/>\n<\/span><span style=\"font-weight: 400\">YYYY-MM-DDThh:mm:ss.sTZD<br \/>\n<\/span><span style=\"font-weight: 400\">YYYY-MM-DD hh:mm:ss.sTZD<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Timestamp based formats:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">hh:mm:ss.sTZD<br \/>\n<\/span><\/em><em><span style=\"font-weight: 400\">hh:mm:ssTZD<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">With N1QL, in addition to the specific formats we also have specific time zone functions, for example <em>string to timezone<\/em> <em>STR_TO_TZ<\/em> which converts the input date to the specified time zone. <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/datefun.html\">See documentation for time zone manipulation functions<\/a><\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT \r\nSTR_TO_TZ('2008-12-25T01:00:00.336-08:00', \r\n'America\/Los_Angeles') as west;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"west\": \"2008-12-25T01:00:00.336-08:00\"\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>Table 1 &#8211; Oracle DateTime types vs. N1QL ISO Time Zone and Date formats<\/em><\/p>\n<\/div>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">* <\/span><span style=\"font-weight: 400\">Both Oracle and N1QL automatically determines whether Daylight Saving Time is in effect for a specified time zone and returns the corresponding local time. \u00a0<\/span><\/p>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">** When dealing with the date formats in N1QL, it is important to remember that each component of the date time string need to be represented by a valid <strong>numeric <\/strong>value. Also the date component of the date-time string has to be separated by a dash &#8220;<em>&#8211;<\/em>&#8221; and the time components need to be separated by a colon &#8220;<em>:<\/em>&#8220;. Otherwise it is not a valid date object.<\/span><\/p>\n<hr \/>\n<p><a href=\"https:\/\/resources.couchbase.com\/c\/relational-no-sql-wp?x=Y7B0ca#page=1\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-14421\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/09\/image_2023-05-22_153949246-1024x622.png\" alt=\"Moving from relational to NoSQL: How to get started from Oracle\" width=\"283\" height=\"172\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/image_2023-05-22_153949246-1024x622.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/image_2023-05-22_153949246-300x182.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/image_2023-05-22_153949246-768x467.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/image_2023-05-22_153949246.png 1218w\" sizes=\"auto, (max-width: 283px) 100vw, 283px\" \/><\/a><strong>Related Resource<\/strong><\/p>\n<p>The beauty of JSON is you can have many different flexible styles for storing date\/time information and use simple functions to compose or extract what is needed at that time you need it. Strict schemas are not required in Couchbase NoSQL, which makes it more flexible than legacy RDBMS solutions. <a href=\"https:\/\/resources.couchbase.com\/c\/relational-no-sql-wp?x=Y7B0ca#page=1\">Learn more by reading our whitepaper<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h2>Oracle and Couchbase Date\/Time Components<\/h2>\n<p><span style=\"font-weight: 400\">For any date\/time types both Oracle and N1QL store extra information in different fields for the input date. These allow the user to extract specific information about the date. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Oracle\u2019s date-time fields are <em>CENTURY<\/em>, <em>YEAR<\/em>, <em>MONTH<\/em>, <em>DAY<\/em>, <em>HOUR,<\/em> <em>MINUTE<\/em> and <em>SECOND<\/em>. The <em>TIMESTAMP<\/em> data types represent seconds as fractional seconds with its precision is determined by the <em>fractional_seconds_precision<\/em> parameter. It also includes the fields <em>TIMEZONE_HOUR<\/em>, <em>TIMEZONE_MINUTE<\/em>, <em>TIMEZONE_REGION<\/em> and <em>TIMEZONE_ABBR<\/em>. It internally converts the Oracle timestamp to date values. The default for the time component is midnight and the default date for the date component is the first day of the current month. A <em>DATE<\/em> datatype stores both the date and time information. <\/span><\/p>\n<p><span style=\"font-weight: 400\">In addition to the fields that Oracle supports for its <em>DATE<\/em> and <em>TIME<\/em> data-types, N1QL also supports <em>MILLENNIUM<\/em>, <em>DECADE<\/em>, <em>QUARTER<\/em>, <em>WEEK<\/em> and <em>MILLISECOND<\/em>. The value of these fields is computed internally using basic arithmetic. N1QL does not support <em>TIMEZONE_REGION<\/em> and <em>TIMEZONE_ABBR<\/em> fields. <\/span><\/p>\n<p><span style=\"font-weight: 400\">A detailed comparison for each field is given in the table below.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Let us consider the following sample row for our examples in timestamp format in Oracle:<\/span><\/p>\n<pre class=\"nums:false lang:default decode:true\">create table t1 (date_purchased timestamp with time zone );\r\ninsert into t1 values (TIMESTAMP '2008-12-25 01:00:00.336 PST');\r\n\r\n&gt; t1 date_purchased\r\n&gt; 2008-12-25,01:00:00.336-08:00<\/pre>\n<p><span style=\"font-weight: 400\">Let us consider the corresponding Couchbase document in a bucket named\u00a0<em>bucket1<\/em>:<\/span><\/p>\n<pre class=\"lang:default decode:true\">create primary index on bucket1;\r\nInsert into bucket1 values (\"23\", {\"date_purchased\":\"2008-12-25T01:00:00.336-08:00\"});\r\n\r\nBucket1 - Document id : 23\r\n{ \r\n \u00a0\"date_purchased\":\"2008-12-25T01:00:00.336-08:00\"\r\n}<\/pre>\n<p><span style=\"font-weight: 400\">The <em>TO_CHAR(\u2018CC\u2019 ), <\/em>with a date as the first argument, and <em>EXTRACT<\/em> function is used in Oracle to retrieve the date-time field values. <\/span><\/p>\n<p><span style=\"font-weight: 400\">For N1QL there are two functions <em>DATE_PART_STR<\/em> or <em>DATE_PART_MILLIS<\/em> depending on whether the date is represented as a JSON string or a numeric millisecond. We will use these functions to give examples for each date-time component listed below.<\/span><\/p>\n<h3>Summary of all date-time components in Oracle and Couchbase<\/h3>\n<div class=\"responsive-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Date-Time\u00a0 components<\/strong><\/td>\n<td><strong>Oracle <\/strong><\/td>\n<td><strong>N1QL<\/strong><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">CENTURY<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">select TO_CHAR(date_purchased, \r\n'CC') from t1;\r\n\r\nTO_CHAR(DATE_PURCHASED,'CC')\r\n\r\n----------------------\r\n\r\n21<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"century\") as C from bucket1;\r\n\r\n\"results\": [\r\n      {\r\n        \"C\": 21\r\n      }\r\n]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">YEAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT EXTRACT(year \r\nFROM date_purchased) \r\n\"D\" from t1;\r\n\r\nD\r\n--------\r\n2008<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">select \r\nDATE_PART_STR(date_purchased,\r\n\"year\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 2008\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">MONTH<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT EXTRACT(month \r\nFROM date_purchased) \"D\" from t1;\r\n\r\nD\r\n--------\r\n12<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"month\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 12\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DAY<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(day \r\nFROM date_purchased) \r\n\"D\" from t1;\r\n\r\nD\r\n--------\r\n25<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"day\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 25\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">HOUR<\/span><\/p>\n<p><b>(different behavior)<\/b><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT EXTRACT(hour \r\nFROM date_purchased) \r\n\"D\" from t1;\r\n\r\nD\r\n--------\r\n9<\/pre>\n<p><span style=\"font-weight: 400\">Oracle considers the time zone component of the input timestamp.<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"hour\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 1\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">The <\/span><b>difference<\/b><span style=\"font-weight: 400\"> in results is because N1QL does not consider the time zone component of the input timestamp.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">MINUTE<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(minute\r\n FROM date_purchased) \r\n\"D\" from t1;\r\n\r\nD\r\n--------\r\n0<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"minute\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SECOND<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(second \r\nFROM date_purchased) \r\n\"D\" from t1;\r\n\r\nD\r\n--------\r\n0,3360<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"second\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">For fractional part see MILLISECOND.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">TIMEZONE_HOUR<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(timezone_hour \r\nFROM date_purchased) \"D\" from t1;\r\n\r\nD\r\n--------\r\n-8<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"timezone_hour\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": -8\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">TIMEZONE_MINUTE<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(timezone_minute \r\nFROM date_purchased) \"D\" from t1;\r\n\r\nD\r\n--------\r\n0<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"timezone_minute\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">TIMEZONE_REGION<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(timezone_region \r\nFROM date_purchased) \"D\" from t1;\r\n\r\nD\r\n--------\r\nPST<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">TIMEZONE_ABBR<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true \">SELECT EXTRACT(timezone_abbr \r\nFROM date_purchased) \"D\" from t1;\r\n\r\nD\r\n--------\r\nPST<\/pre>\n<p>&nbsp;<\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">TIMEZONE (offset from UTC)<\/span><\/td>\n<td><span style=\"font-weight: 400\">(Data type itself, not a field)<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"timezone\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": -28800\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">The number here represents the time zone in seconds.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">MILLENNIUM <\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><b>Millennium<\/b><em><span style=\"font-weight: 400\"> = (Year \/ 1000) + 1 \u00a0<\/span><\/em><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"millennium\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 3\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DECADE<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><b>Decade<\/b><em><span style=\"font-weight: 400\"> = Year \/ 10<\/span><\/em><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"decade\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 200\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">QUARTER<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><b>Quarter<\/b><em><span style=\"font-weight: 400\"> = (Month + 2) \/ 3<\/span><\/em><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"quarter\") as D from bucket1;\r\n\r\n\u00a0\u00a0\u00a0\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 4\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">WEEK <\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><b>Week<\/b><span style=\"font-weight: 400\"><em> = int(math.Ceil(float64(YearDay) \/ 7.0))<\/em><\/span><\/p>\n<p><span style=\"font-weight: 400\"><em>YearDay<\/em> returns the day of the year specified by the time, in the range 1 to 365 for non-leap years, and 1 to 366 in leap years. \u00a0(See <\/span><a href=\"https:\/\/golang.org\/pkg\/time\/\"><span style=\"font-weight: 400\">golang time package<\/span><\/a><span style=\"font-weight: 400\">)<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"week\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 52\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">MILLISECOND<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><b>Millisecond<\/b><em><span style=\"font-weight: 400\"> = Nanosecond \/ 10<\/span><span style=\"font-weight: 400\">6<\/span><\/em><span style=\"font-weight: 400\"><br \/>\nas an integer<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"millisecond\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 336\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">ISO_YEAR<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><span style=\"font-weight: 400\">Iso_year = ISO 8601 year for the input timestamp.<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"iso_year\") as C from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"C\": 2008\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">ISO_WEEK<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><span style=\"font-weight: 400\">Iso_week = ISO 8601 week for the input timestamp.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The week usually ranges from 1 to 53. For example, Jan 1 to Jan 3 of year n might belong to Week 52 or 53 of year n-1, and Dec 29 to 31 might belong to week 1 of year n+1.<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"iso_week\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 52\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DAY_OF_YEAR (DOY)<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><span style=\"font-weight: 400\">Day_of_year or doy <em>= YearDay<\/em><\/span><\/p>\n<p><span style=\"font-weight: 400\"> See <\/span><a href=\"https:\/\/golang.org\/pkg\/time\/\"><span style=\"font-weight: 400\">golang time package.<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400\"><em>YearDay<\/em> returns the day of the year specified by the time, in the range 1 to 365 for non-leap years, and 1 to 366 in leap years.<\/span><\/p>\n<pre class=\"lang:default decode:true\">select \r\nDATE_PART_STR(date_purchased,\r\n\"doy\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 360\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DAY_OF_WEEK (DOW)<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u274c<\/span><\/td>\n<td><span style=\"font-weight: 400\">\u2705<\/span><\/p>\n<p><span style=\"font-weight: 400\">Day_of_week or dow = <em>Weekday<\/em> function, which returns the day of the week for the given time. See <\/span><a href=\"https:\/\/golang.org\/pkg\/time\/\"><span style=\"font-weight: 400\">golang time package<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<pre class=\"lang:default decode:true \">select \r\nDATE_PART_STR(date_purchased,\r\n\"dow\") as D from bucket1;\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"D\": 4\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>Time zone considerations<\/h2>\n<p><span style=\"font-weight: 400\">For N1QL, within the date time format, <em>TIMEZONE_REGION<\/em> and <em>TIMEZONE_ABBR<\/em> are not supported. But they can be passed into the <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/datefun.html#manipulating-components\">time zone specific N1QL functions.<\/a><\/span><\/p>\n<p><span style=\"font-weight: 400\">As we can see above when it comes to representing the <em>TIMESTAMP<\/em> within N1QL dates, there are additional fields supported. These are <em>ISO_YEAR<\/em>, <em>ISO_WEEK<\/em>, <em>DAY_OF_YEAR <\/em>(DOY), <em>DAY_OF_WEEK <\/em>(DOW) and <em>TIMEZONE<\/em> which is the offset from UTC. <\/span><\/p>\n<p><span style=\"font-weight: 400\">In the absence of a time zone indicator, the current local time zone is take from where the Couchbase server is located. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Let us delve a little deeper into the <em>TIMEZONE<\/em> comparisons between N1QL and Oracle. The <em>TIMESTAMP<\/em> <em>WITH TIME ZONE<\/em> and <em>TIMESTAMP WITH LOCAL TIME ZONE<\/em> data types in Oracle are variants of the <em>TIMESTAMP<\/em> data type. The former includes the time zone information, which is the time zone offset which is the time relative to UTC or time zone region name in its value, and the later includes the current session time zone. <em>TIMESTAMP WITH LOCAL TIME ZONE<\/em> does not store time zone information internally, but you can see local time zone information in SQL output if the <em>TZH:TZM<\/em> or <em>TZR TZD<\/em> format elements are specified. See Oracle documentation: <a href=\"https:\/\/docs.oracle.com\/cd\/B19306_01\/server.102\/b14225\/ch4datetime.htm#i1005943\">Datetime Datatypes and Time Zone Support <\/a><\/span><span style=\"font-weight: 400\">for more details.<\/span><\/p>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">Oracle:\u00a0\u00a0<\/span><em><span style=\"font-weight: 400\">TIMESTAMP &#8216;2017-01-31 03:49:30.612 -08:00&#8217;<\/span><\/em><\/p>\n<p style=\"padding-left: 40px\"><span style=\"font-weight: 400\">Couchbase:\u00a0<\/span><em><span style=\"font-weight: 400\">&#8220;2017-01-31T03:49:30.612-08:00&#8221;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">For Oracle, if two dates being compared represent the same value in UTC, then they are equal:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">TIMESTAMP &#8216;2017-01-15 8:00:00 -8:00&#8217; == TIMESTAMP &#8216;2017-01-15 10:00:00 -6:00&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">In N1QL, to compare full date values we need to convert them to milliseconds.<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">STR_TO_MILLIS(&#8220;2017-01-31T05:49:30.612-06:00&#8221;) == STR_TO_MILLIS(&#8220;2017-01-31T03:49:30.612-08:00&#8221;) \u00a0<\/span><\/em><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">Value: 1485863370612<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">In Oracle, we can replace this offset with the <em>Time Zone Region<\/em> (TZR) and the abbreviation. The abbreviation (TZD) is used in the event the region value is ambiguous (when the US switches to daylight saving time). <\/span><\/p>\n<p><span style=\"font-weight: 400\">However in N1QL the time zone component of the date is always represented as a UTC offset. <\/span><\/p>\n<p><span style=\"font-weight: 400\">For example:<\/span><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">TIMESTAMP &#8216;2017-01-15 8:00:00 -8:00&#8217; <\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400\">can also be: <\/span><\/em><\/p>\n<p style=\"padding-left: 40px\"><em><span style=\"font-weight: 400\">TIMESTAMP &#8216;2017-01-15 8:00:00 US\/Pacific PDT&#8217;<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400\">Oracle also supports interval data types <em>INTERVAL YEAR TO MONTH<\/em> and <em>INTERVAL DAY TO SECOND<\/em>. These store time durations. The former stores the duration using year and month fields and the latter using the days, hours, minutes and second fields. With N1QL, computing an interval is made easy using date time functions and the \u201cpart\u201d component.<\/span><\/p>\n<p><span style=\"font-weight: 400\">There are multiple ways to insert date or time data into Oracle. The user can insert a formatted string based on the NLS format value, or a literal with explicit conversion using the <em>TO_DATE<\/em> \/ <em>TO_TIMESTAMP<\/em> or <em>TO_TIMESTAMP_TZ<\/em> functions or implicit conversion.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In N1QL, all dates are added to a document as a string in the format specified above, or as a number representing a Unix timestamp in milliseconds. This makes handling dates very easy and flexible since the functions perform all the necessary arithmetic for the user. One drawback, though, is that the date has to exactly match one of the formats in the date formats table. This restricts the user to use only a subset of available formats. <\/span><\/p>\n<p><span style=\"font-weight: 400\">One workaround for this limitation with N1QL is to use the string functions and massage the input date to reflect the format you want. For example:<\/span><\/p>\n<p><span style=\"font-weight: 400\">Convert 2016-09-23T18:48:11.000+00:00 into &#8220;YYYY\/MM\/DD&#8221;<\/span><\/p>\n<pre class=\"lang:default decode:true\">SELECT \u00a0to_string(date_part_str(\"2016-09-23T18:48:11.000+00:00\", \"year\" )) || \"\/\" || to_string(date_part_str(\"2016-09-23T18:48:11.000+00:00\", \"month\" )) || \"\/\" || to_string(date_part_str(\"2016-09-23T18:48:11.000+00:00\", \"day\" ));\r\n\r\n\"results\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"$1\": \"2016\/9\/23\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">As we can see, N1QL simplifies manipulating Dates and Timestamps by representing it as a string or a number when compared to Oracle date to timestamp format. But this means that the user is restricted to use only specified date time formats and does not have the freedom to manipulate these formats, which Oracle does very easily using its Format Parameters.<\/span><\/p>\n<p><span style=\"color: #343e47;font-family: Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: 50px\">Keep learning<\/span><\/p>\n<p>Ready to try querying JSON documents with Couchbase SQL++ language?<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Start a free <a href=\"https:\/\/cloud.couchbase.com\">Couchbase Capella trial<\/a> and see how easy it can be.<\/li>\n<li>See the <a href=\"https:\/\/www.youtube.com\/embed\/zoZW0tM6hwU\">Oracle to Couchbase migration<\/a> strategies video<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><iframe loading=\"lazy\" title=\"Oracle to Couchbase Migration - CBConnect21\" width=\"900\" height=\"506\" src=\"https:\/\/www.youtube.com\/embed\/zoZW0tM6hwU?feature=oembed&#038;enablejsapi=1&#038;origin=https:\/\/www.couchbase.com\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date and Time functions and formats can vary for different databases. In this article, we shall compare Couchbase ISO-based Date-Time functions with Oracle Date format. Date formats vary between relational and NoSQL database due to the nature of NoSQL JSON [&hellip;]<\/p>\n","protected":false},"author":82066,"featured_media":14419,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,1816,1819,1812],"tags":[9405,1592,1385],"ppma_author":[9657],"class_list":["post-4045","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-couchbase-server","category-data-modeling","category-n1ql-query","tag-database-migration","tag-oracle","tag-rdbms"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Oracle Date-Time &amp; Timestamp Format Compared to Couchbase<\/title>\n<meta name=\"description\" content=\"Explore the differences between Oracle&#039;s and Couchbase&#039;s date-time formats and their handling of timestamps here. We offer side-by-side examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle Date Format: N1QL and Support for Date-Time Functions\" \/>\n<meta property=\"og:description\" content=\"Explore the differences between Oracle&#039;s and Couchbase&#039;s date-time formats and their handling of timestamps here. We offer side-by-side examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-23T04:36:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T06:43:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Couchbase Product Marketing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Couchbase Product Marketing\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\"},\"author\":{\"name\":\"Couchbase Product Marketing\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/befa2a9de827aed2f8354f939cd6598e\"},\"headline\":\"Oracle Date Format: N1QL and Support for Date-Time Functions\",\"datePublished\":\"2017-09-23T04:36:20+00:00\",\"dateModified\":\"2025-06-14T06:43:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\"},\"wordCount\":2325,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png\",\"keywords\":[\"database migration\",\"oracle\",\"RDBMS\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Server\",\"Data Modeling\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\",\"name\":\"Oracle Date-Time & Timestamp Format Compared to Couchbase\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png\",\"datePublished\":\"2017-09-23T04:36:20+00:00\",\"dateModified\":\"2025-06-14T06:43:22+00:00\",\"description\":\"Explore the differences between Oracle's and Couchbase's date-time formats and their handling of timestamps here. We offer side-by-side examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle Date Format: N1QL and Support for Date-Time Functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/befa2a9de827aed2f8354f939cd6598e\",\"name\":\"Couchbase Product Marketing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/5112ed57023bd2807ae7086c2fe68752\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4760a19fc4ed6b8b830ba98f0869ed0d8ee6729e2593881e1a68032b9c281d5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4760a19fc4ed6b8b830ba98f0869ed0d8ee6729e2593881e1a68032b9c281d5d?s=96&d=mm&r=g\",\"caption\":\"Couchbase Product Marketing\"},\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/couchbase-pmm\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Oracle Date-Time & Timestamp Format Compared to Couchbase","description":"Explore the differences between Oracle's and Couchbase's date-time formats and their handling of timestamps here. We offer side-by-side examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/","og_locale":"en_US","og_type":"article","og_title":"Oracle Date Format: N1QL and Support for Date-Time Functions","og_description":"Explore the differences between Oracle's and Couchbase's date-time formats and their handling of timestamps here. We offer side-by-side examples.","og_url":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-09-23T04:36:20+00:00","article_modified_time":"2025-06-14T06:43:22+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png","type":"image\/png"}],"author":"Couchbase Product Marketing","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Couchbase Product Marketing","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/"},"author":{"name":"Couchbase Product Marketing","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/befa2a9de827aed2f8354f939cd6598e"},"headline":"Oracle Date Format: N1QL and Support for Date-Time Functions","datePublished":"2017-09-23T04:36:20+00:00","dateModified":"2025-06-14T06:43:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/"},"wordCount":2325,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png","keywords":["database migration","oracle","RDBMS"],"articleSection":["Best Practices and Tutorials","Couchbase Server","Data Modeling","SQL++ \/ N1QL Query"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/","url":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/","name":"Oracle Date-Time & Timestamp Format Compared to Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png","datePublished":"2017-09-23T04:36:20+00:00","dateModified":"2025-06-14T06:43:22+00:00","description":"Explore the differences between Oracle's and Couchbase's date-time formats and their handling of timestamps here. We offer side-by-side examples.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/09\/oracle-date-time-compare-couchbase.png","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Oracle Date Format: N1QL and Support for Date-Time Functions"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/befa2a9de827aed2f8354f939cd6598e","name":"Couchbase Product Marketing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/5112ed57023bd2807ae7086c2fe68752","url":"https:\/\/secure.gravatar.com\/avatar\/4760a19fc4ed6b8b830ba98f0869ed0d8ee6729e2593881e1a68032b9c281d5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4760a19fc4ed6b8b830ba98f0869ed0d8ee6729e2593881e1a68032b9c281d5d?s=96&d=mm&r=g","caption":"Couchbase Product Marketing"},"url":"https:\/\/www.couchbase.com\/blog\/author\/couchbase-pmm\/"}]}},"authors":[{"term_id":9657,"user_id":82066,"is_guest":0,"slug":"couchbase-pmm","display_name":"Couchbase Product Marketing","avatar_url":{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/06\/image_2022-06-17_105452255.png","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/06\/image_2022-06-17_105452255.png"},"author_category":"","last_name":"","first_name":"Couchbase Product Marketing","job_title":"","user_url":"","description":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/4045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/82066"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=4045"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/4045\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/14419"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=4045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=4045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=4045"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=4045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}