{"id":1168,"date":"2017-09-22T21:36:20","date_gmt":"2017-09-23T04:36:20","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/"},"modified":"2017-09-22T21:36:20","modified_gmt":"2017-09-23T04:36:20","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":"\n<p><span>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\n\n\n<h2 class=\"wp-block-heading\">Oracle date\/time types<\/h2>\n\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<h2 class=\"wp-block-heading\">Couchbase date formats<\/h2>\n\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>For example, in Oracle timestamp format:<\/span><\/p>\n\n\n\n<p><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\n\n\n<p><span>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\n\n\n<p><em><span>For example, 2008-12-25 17:30:00<\/span><\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Time precision<\/h3>\n\n\n\n<p><span>In Oracle, <\/span><em><span>fractional_seconds_precision<\/span><\/em><span> 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\n\n\n<p><span>For example, in Oracle the date-time format can be given as:<\/span><\/p>\n\n\n\n<p><em><span>TIMESTAMP &#8216;YYYY-MM-DD HH24:MI:SS.FFF&#8217;<\/span> <\/em><\/p>\n\n\n\n<p><span>Using this we can define the timestamp to be: <\/span><em><span>&#8216;2006-01-02 15:04:05.999&#8217;<\/span><\/em><\/p>\n\n\n\n<p><span><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>\u00a0<em>&#8220;2006-01-02T15:04:05.999&#8221;<\/em>. <\/span><span>However,<\/span> <span>N1QL supports 3 digit precision (nanosecond precision) and Oracle supports up to 9 digit fractional second precision. <\/span><\/p>\n\n\n\n<p><span>This means that if we specify the date: <\/span><span><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\n\n\n<p><span>For N1QL, <\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.999123456&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n \u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: &#8220;2006-01-02T15:04:05.999&#8221;<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n\n\n\n<p><span>For Oracle,<\/span><\/p>\n\n\n<p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n\n\n\n<p><span>Using N1QL, If we specify a more than 9 digits, the Date-Time function returns null. <\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n\n\n\n<p><span>For Oracle Date-Time format, if you give more than 9 digits for the fractional seconds part it throws an error: <\/span><em><span>ORA-01830: date format picture ends before converting entire input string<\/span><\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Comparison of Oracle and Couchbase date\/time approaches<\/h2>\n\n\n\n<p><span>A comparison of the Couchbase N1QL and Oracle&#8217;s date-time support is given in the following table:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-table\"><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>DATE <\/span><\/em><span>data type f<\/span><span>ormat is defined by:<\/span>\n<p><em><span>NLS_DATE_FORMAT<\/span><\/em><\/p>\n<p><em><span>NLS_DATE_LANGUAGE<\/span><\/em><\/p>\n<p><span>Example: <\/span><\/p>\n<p><span>The <em>NLS_DATE_FORMAT<\/em> parameter needs to be set <\/span><span>in the initialization parameter file:<\/span><\/p>\n<p><em><span>NLS_DATE_FORMAT=&#8217;YYYY-MON-DD&#8217;<\/span><\/em><\/p>\n<p><span>Sample date:<\/span><\/p>\n<p><em><span>DATE &#8216;2008-DEC-25&#8217;<\/span><\/em><\/p>\n<p><span>To set the <em>NLS_DATE_LANGUAGE<\/em> parameter we <\/span><span>can use the <em>ALTER SESSION<\/em> statement.<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>In N1QL there is no specific date\/time\/<\/span><span>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>\n<p><span>See the <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/datefun.html\"><span>documentation<\/span><\/a><span> for complete list.<\/span><\/p>\n<p><span>Allowed date format*:<\/span><\/p>\n<p><em><span>YYYY-MM-DD<\/span><\/em><\/p>\n<p><span>Example:<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]{<br \/>\n\u00a0&#8220;Date&#8221; : &#8220;2008-12-25&#8221;<br \/>\n}[\/crayon]<\/p>\n<\/p>\n<p><span>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><em>YYYY-MM-DDThh:mm:ss.sTZD<\/em><\/p>\n<p><span>Use the <em>DATE_FORMAT_STR<\/em> function to convert the date format from <em>YYYY-MM-DD<\/em> to <\/span><span><em>&#8216;YYYY-MON-DD&#8217;<\/em>\u00a0<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]select date_format_str(&#8216;2008-12-25&#8217;,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8216;1111-DEC-12&#8217;) D;<\/p>\n<p>&#8220;results&#8221;: [<br \/>\n\u00a0\u00a0\u00a0\u00a0{<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;D&#8221;: &#8220;2008-12-25T00:00:00-08:00&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0}<br \/>\n]<br \/>\n[\/crayon]<\/p>\n<\/p>\n<p><span>Couchbase supports only <strong>ISO Extended date formats<\/strong>. It doesn&#8217;t support non-numeric dates in multiple languages.<\/span><\/p><\/td>\n<\/tr>\n<tr>\n<td><span><em>TIMESTAMP<\/em> data type f<\/span><span>ormat is defined by:<\/span>\n<p><em><span>NLS_TIMESTAMP_FORMAT<\/span><\/em><\/p>\n<p><span>You can specify the value of <\/span><em><span>NLS_TIMESTAMP_FORMAT<\/span><\/em><span> by setting it in the initialization parameter file. <\/span><\/p>\n<p><em><span>NLS_TIMESTAMP_FORMAT \u00a0= &#8216;YYYY-MM-DD HH:MI:SS.FF&#8217;<\/span><\/em><\/p>\n<p><span>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<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT<br \/>\nTO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336&#8242;,<br \/>\n&#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) from dual;<\/p>\n<p>TO_TIMESTAMP(&#8217;25-DEC-200801:00:00.336&#8242;,<br \/>\n&#8216;DD-MON-YYYYHH:MI:SS.FF&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n2008-12-25 01:00:00.336[\/crayon]<\/p>\n<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>Same functions as date but with a different input date format input argument. This needs to be explicitly provided.\u00a0<\/span>\n<p><span>The date format along with timestamp components:<\/span><\/p>\n<p><em><span>YYYY-MM-DD hh:mm:ss<br>\n<\/span><\/em><em><span>YYYY-MM-DDThh:mm:ss<br>\n<\/span><\/em><em><span>YYYY-MM-DD hh:mm:ss.s<br>\n<\/span><\/em><em>YYYY-MM-DDThh:mm:ss.s<\/em><\/p>\n<p><span>Time based formats:<\/span><\/p>\n<p><em><span>hh:mm:ss<br>\n<\/span><span>Hh:mm:ss.s<\/span><\/em><\/p>\n<p><span>Couchbase supports nanosecond precision.<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]select<br \/>\ndate_format_str(&#8216;2008-12-25T01:00:00.336&#8217;,<br \/>\n&#8216;1111-DEC-12 01:00:00.00&#8217;) D;<\/p>\n<p>&#8220;results&#8221;: [<br \/>\n\u00a0\u00a0\u00a0\u00a0{<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;D&#8221;: &#8220;2008-12-25T01:00:00.336-08:00&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0}<br \/>\n\u00a0][\/crayon]<\/p>\n<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>Data types:<\/span>\n<p><em><span>TIMESTAMP WITH TIMEZONE<br>\n<\/span><\/em><em><span>TIMESTAMP WITH LOCAL TIME ZONE<\/span><\/em><\/p>\n<p><span>Format defined by:<\/span><\/p>\n<p><em><span>NLS_TIMESTAMP_TZ_FORMAT<\/span><\/em><\/p>\n<p><span>You can specify the value of <\/span><em><span>NLS_TIMESTAMP_TZ_FORMAT<\/span><\/em><span> by setting it in the initialization parameter file:<\/span><\/p>\n<p><em><span>NLS_TIMESTAMP_TZ_FORMAT \u00a0= &#8216;YYYY-MM-DD HH:MI:SS.FF TZH:TZM&#8217;<\/span><\/em><\/p>\n<p><span>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<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_CHAR(TO_TIMESTAMP_TZ<br \/>\n(&#8216;2008-12-25, 01:00:00.336 -08:00&#8217;,<br \/>\n&#8216;yyyy-mm-dd hh:mi:ss.ff TZR&#8217;)) FROM DUAL;<\/p>\n<p>TO_CHAR(TO_TIMESTAMP_TZ<br \/>\n(&#8216;2008-12-25,01:00:00.336-08:00&#8217;,<br \/>\n&#8216;YYYY-MM-DDHH:MI:SS.FFTZR&#8217;))<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n25-DEC-08 01.00.00.336000000 AM -08:00[\/crayon]<\/p>\n<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>Includes the DateTime components of format:<\/span>\n<p><em><span>YYYY-MM-DDThh:mm:ssTZD<br>\n<\/span><span>YYYY-MM-DD hh:mm:ssTZD<br>\n<\/span><span>YYYY-MM-DDThh:mm:ss.sTZD<br>\n<\/span><span>YYYY-MM-DD hh:mm:ss.sTZD<\/span><\/em><\/p>\n<p><span>Timestamp based formats:<\/span><\/p>\n<p><em><span>hh:mm:ss.sTZD<br>\n<\/span><\/em><em><span>hh:mm:ssTZD<\/span><\/em><\/p>\n<p><span>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<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT<br \/>\nSTR_TO_TZ(&#8216;2008-12-25T01:00:00.336-08:00&#8217;,<br \/>\n&#8216;America\/Los_Angeles&#8217;) as west;<\/p>\n<p>&#8220;results&#8221;: [<br \/>\n\u00a0\u00a0\u00a0\u00a0{<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: &#8220;2008-12-25T01:00:00.336-08:00&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0}<br \/>\n\u00a0\u00a0\u00a0]<br \/>\n[\/crayon]<\/p>\n<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<p><em>Table 1 &#8211; Oracle DateTime types vs. N1QL ISO Time Zone and Date formats<\/em><\/p>\n\n\n\n<p><span>* <\/span><span>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\n\n\n<p><span>** 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\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\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\/wp-content\/uploads\/sites\/5\/2026\/05\/image_2023-05-22_153949246-1024x622-1.png\" alt=\"Moving from relational to NoSQL: How to get started from Oracle\" width=\"283\" height=\"172\"><\/a><strong>Related Resource<\/strong><\/p>\n\n\n\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\n\n\n<p>\u00a0<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Oracle and Couchbase Date\/Time Components<\/h2>\n\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>A detailed comparison for each field is given in the table below.<\/span><\/p>\n\n\n\n<p><span>Let us consider the following sample row for our examples in timestamp format in Oracle:<\/span><\/p>\n\n\n\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n0<\/p>\n\n\n\n<p><span>Let us consider the corresponding Couchbase document in a bucket named\u00a0<em>bucket1<\/em>:<\/span><\/p>\n\n\n\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n1<\/p>\n\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<h3 class=\"wp-block-heading\">Summary of all date-time components in Oracle and Couchbase<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><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>CENTURY<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n2<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>YEAR<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n4<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>MONTH<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n6<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>DAY<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n8<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon nums=&#8221;false&#8221; lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT TO_TIMESTAMP(&#8217;25-DEC-2008 01:00:00.336123456&#8242;, &#8216;dd-mon-yyyy hh:mi:ss.ff&#8217;) as D from dual;<\/p>\n<p>&gt; D<br \/>\n&gt; 2008-12-25 01:00:00.336123456[\/crayon]<\/p>\n9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>HOUR<\/span>\n<p><b>(different behavior)<\/b><\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n0<\/p>\n<p><span>Oracle considers the time zone component of the input timestamp.<\/span><\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n1<\/p>\n<p><span>The <\/span><b>difference<\/b><span> in results is because N1QL does not consider the time zone component of the input timestamp.<\/span><\/p><\/td>\n<\/tr>\n<tr>\n<td><span>MINUTE<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n2<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>SECOND<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n4<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n5<\/p>\n<p><span>For fractional part see MILLISECOND.<\/span><\/p><\/td>\n<\/tr>\n<tr>\n<td><span>TIMEZONE_HOUR<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n6<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>TIMEZONE_MINUTE<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n8<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]SELECT STR_TO_TZ(&#8220;2006-01-02T15:04:05.9991234567&#8221;, &#8216;America\/Los_Angeles&#8217;) as west;<br \/>\n\u00a0\u00a0\u00a0&#8220;results&#8221;: [<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;west&#8221;: null<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n \u00a0\u00a0\u00a0][\/crayon]<\/p>\n9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>TIMEZONE_REGION<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n0<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u274c<\/span><\/td>\n<\/tr>\n<tr>\n<td><span>TIMEZONE_ABBR<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n1<\/p>\n<p>\u00a0<\/p><\/td>\n<td><span>\u274c<\/span><\/td>\n<\/tr>\n<tr>\n<td><span>TIMEZONE (offset from UTC)<\/span><\/td>\n<td><span>(Data type itself, not a field)<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n2<\/p>\n<p><span>The number here represents the time zone in seconds.<\/span><\/p><\/td>\n<\/tr>\n<tr>\n<td><span>MILLENNIUM <\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><b>Millennium<\/b><em><span> = (Year \/ 1000) + 1 \u00a0<\/span><\/em><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>DECADE<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><b>Decade<\/b><em><span> = Year \/ 10<\/span><\/em><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>QUARTER<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><b>Quarter<\/b><em><span> = (Month + 2) \/ 3<\/span><\/em><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>WEEK <\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><b>Week<\/b><span><em> = int(math.Ceil(float64(YearDay) \/ 7.0))<\/em><\/span><\/p>\n<p><span><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>golang time package<\/span><\/a><span>)<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>MILLISECOND<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><b>Millisecond<\/b><em><span> = Nanosecond \/ 10<\/span><span>6<\/span><\/em><span><br>\nas an integer<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>ISO_YEAR<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><span>Iso_year = ISO 8601 year for the input timestamp.<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>ISO_WEEK<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><span>Iso_week = ISO 8601 week for the input timestamp.<\/span><\/p>\n<p><span>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<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]ALTER SESSION SET NLS_DATE_LANGUAGE = FRENCH;<\/p>\n<p>SELECT TO_CHAR(SYSDATE, &#8216;Day:Dd Month yyyy&#8217;)<br \/>\nFROM DUAL;<\/p>\n<p>TO_CHAR(SYSDATE,&#8217;DAY:DDMONTHYYYY&#8217;)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLundi :21 Ao\u00fbt \u00a0\u00a0\u00a0\u00a0\u00a02017[\/crayon]<\/p>\n9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>DAY_OF_YEAR (DOY)<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><span>Day_of_year or doy <em>= YearDay<\/em><\/span><\/p>\n<p><span> See <\/span><a href=\"https:\/\/golang.org\/pkg\/time\/\"><span>golang time package.<\/span><\/a><\/p>\n<p><span><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<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]{<br \/>\n\u00a0&#8220;Date&#8221; : &#8220;2008-12-25&#8221;<br \/>\n}[\/crayon]<\/p>\n0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><span>DAY_OF_WEEK (DOW)<\/span><\/td>\n<td><span>\u274c<\/span><\/td>\n<td><span>\u2705<\/span>\n<p><span>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>golang time package<\/span><\/a><span>.<\/span><\/p>\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]{<br \/>\n\u00a0&#8220;Date&#8221; : &#8220;2008-12-25&#8221;<br \/>\n}[\/crayon]<\/p>\n1<\/p>\n<p>\u00a0<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Time zone considerations<\/h2>\n\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>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>for more details.<\/span><\/p>\n\n\n\n<p><span>Oracle:\u00a0\u00a0<\/span><em><span>TIMESTAMP &#8216;2017-01-31 03:49:30.612 -08:00&#8217;<\/span><\/em><\/p>\n\n\n\n<p><span>Couchbase:\u00a0<\/span><em><span>&#8220;2017-01-31T03:49:30.612-08:00&#8221;<\/span><\/em><\/p>\n\n\n\n<p><span>For Oracle, if two dates being compared represent the same value in UTC, then they are equal:<\/span><\/p>\n\n\n\n<p><em><span>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\n\n\n<p><span>In N1QL, to compare full date values we need to convert them to milliseconds.<\/span><\/p>\n\n\n\n<p><em><span>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\n\n\n<p><em><span>Value: 1485863370612<\/span><\/em><\/p>\n\n\n\n<p><span>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\n\n\n<p><span>However in N1QL the time zone component of the date is always represented as a UTC offset. <\/span><\/p>\n\n\n\n<p><span>For example:<\/span><\/p>\n\n\n\n<p><em><span>TIMESTAMP &#8216;2017-01-15 8:00:00 -8:00&#8217; <\/span><\/em><\/p>\n\n\n\n<p><em><span>can also be: <\/span><\/em><\/p>\n\n\n\n<p><em><span>TIMESTAMP &#8216;2017-01-15 8:00:00 US\/Pacific PDT&#8217;<\/span><\/em><\/p>\n\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>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\n\n\n<p><span>Convert 2016-09-23T18:48:11.000+00:00 into &#8220;YYYY\/MM\/DD&#8221;<\/span><\/p>\n\n\n\n<p><p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]{<br \/>\n\u00a0&#8220;Date&#8221; : &#8220;2008-12-25&#8221;<br \/>\n}[\/crayon]<\/p>\n2<\/p>\n\n\n\n<p><span>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\n\n\n<p><span>Keep learning<\/span><\/p>\n\n\n\n<p>Ready to try querying JSON documents with Couchbase SQL++ language?<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Start a free <a href=\"https:\/\/cloud.couchbase.com\">Couchbase Capella trial<\/a> and see how easy it can be.<\/li>\n\n\n<li>See the <a href=\"https:\/\/www.youtube.com\/embed\/zoZW0tM6hwU\">Oracle to Couchbase migration<\/a> strategies video<\/li>\n\n<\/ul>\n\n\n\n<p><iframe loading=\"lazy\" title=\"Oracle to Couchbase Migration - CBConnect21\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/zoZW0tM6hwU?feature=oembed\" 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 formats. Learn more in this webcast about how to avoid sacrificing your SQL knowledge while [&hellip;]<\/p>\n","protected":false},"author":82066,"featured_media":1165,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[136,54,189,18],"tags":[283,195,87],"ppma_author":[284],"class_list":["post-1168","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"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\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=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/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\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\\\/\"},\"wordCount\":3370,\"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\\\/5\\\/2026\\\/05\\\/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\\\/5\\\/2026\\\/05\\\/oracle-date-time-compare-couchbase.png\",\"datePublished\":\"2017-09-23T04:36:20+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\\\/5\\\/2026\\\/05\\\/oracle-date-time-compare-couchbase.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/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\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"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:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4760a19fc4ed6b8b830ba98f0869ed0d8ee6729e2593881e1a68032b9c281d5d?s=96&d=mm&r=g5112ed57023bd2807ae7086c2fe68752\",\"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","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/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","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/dates-timestamps-timezones-comparative-study-oracle-n1ql-support-date-time-feature-part-1\/"},"wordCount":3370,"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\/5\/2026\/05\/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\/5\/2026\/05\/oracle-date-time-compare-couchbase.png","datePublished":"2017-09-23T04:36:20+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\/5\/2026\/05\/oracle-date-time-compare-couchbase.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/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\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","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:\/\/secure.gravatar.com\/avatar\/4760a19fc4ed6b8b830ba98f0869ed0d8ee6729e2593881e1a68032b9c281d5d?s=96&d=mm&r=g5112ed57023bd2807ae7086c2fe68752","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\/"}]}},"acf":[],"authors":[{"term_id":284,"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\/5\/2026\/05\/image_2022-06-17_105452255-40.png","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/image_2022-06-17_105452255-40.png"},"0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/1168","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=1168"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/1165"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=1168"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}