trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traflm <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #872: [TRAFODION-2285] Document TO_DATE, TO...
Date Thu, 08 Dec 2016 15:38:45 GMT
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/872#discussion_r91537769
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
---
    @@ -7523,7 +7526,139 @@ TIMESTAMPDIFF (SQL_TSI_WEEK, DATE '2006-01-01', DATE '2006-01-09')
     ```
     TIMESTAMPDIFF (SQL_TSI_DAY, DATE '2004-03-01', DATE '2004-02-01')
     ```
    -
    +
    +<<<
    +[[to_date_function]]
    +== TO_DATE Function
    +
    +The TO_DATE function converts a character value to a date. The optional
    +second argument describes the format of the character value.
    +
    +```
    +TO_DATE(character-expression [,format-string])
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +* `_format-string_`
    ++
    +is one of the following character string literals:
    +
    +** 'YYYY-MM-DD'
    +** 'MM/DD/YYYY'
    +** 'DD.MM.YYYY'
    +** 'YYYY-MM'
    +** 'MM/DD/YYYY'
    +** 'YYYY/MM/DD'
    +** 'YYYYMMDD'
    +** 'YY/MM/DD'
    +** 'MM/DD/YY'
    +** 'MM-DD-YYYY'
    +** 'YYYYMM'
    +** 'DD-MM-YYYY'
    +** 'DD-MON-YYYY'
    +** 'DDMONYYYY'
    +
    +If the _format-string_ argument is omitted, 'YYYY-MM-DD' is used as the
    +default.
    +
    +[[examples_of_to_date]]
    +=== Examples of TO_DATE
    +
    +* This function returns the date value '2016-12-07':
    ++
    +```
    +TO_DATE ('2016-12-07')
    +```
    +
    +* This function returns the date value '2016-07-12':
    ++
    +```
    +TO_DATE ('12-07-2016', 'DD-MM-YYYY')
    +```
    +
    +* This function returns the date value '2016-12-07':
    ++
    +```
    +TO_DATE ('07DEC2016', 'DDMONYYYY')
    +```
    +
    +<<<
    +[[to_time_function]]
    +== TO_TIME Function
    +
    +The TO_TIME function converts a character value to a time or timestamp. The
    +second argument describes the format of the character value.
    +
    +```
    +TO_TIME(character-expression ,format-string)
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +* `_format-string_`
    ++
    +is one of the following character string literals:
    +
    +** 'HH24:MI:SS'
    +** 'YYYYMMDDHH24MISS'
    +** 'DD.MM.YYYY:HH24.MI.SS'
    +** 'YYYY-MM-DD HH24:MI:SS'
    +** 'YYYYMMDD:HH24:MI:SS'
    +** 'MMDDYYYY HH24:MI:SS'
    +** 'MM/DD/YYYY HH24:MI:SS'
    +** 'DD-MON-YYYY HH:MI:SS'
    +** 'MONTH DD, YYYY, HH:MI'
    +** 'DD.MM.YYYY HH24.MI.SS'
    +
    +[[considerations_for_to_time]]
    +=== Considerations for TO_TIME
    +
    +If the _format-string_ is 'HH24:MI:SS', then the output data time is time. Otherwise
    +the output data type is timestamp.
    +
    +[[examples_of_to_time]]
    +=== Examples of TO_TIME
    +
    +* This function returns the time value '17:05:01':
    ++
    +```
    +TO_TIME ('17:05:01', 'HH24:MI:SS')
    +```
    +
    +* This function returns the timestamp value '2016-12-07 17:05:01.000000':
    ++
    +```
    +TO_TIME ('07.12.2016:17.05.01', 'DD.MM.YYYY:HH24.MI.SS')
    +```
    +			
    +<<<
    +[[to_timestamp_function]]
    +== TO_TIMESTAMP Function
    +
    +The TO_TIMESTAMP function converts a character value to a timestamp.
    +	
    +```
    +TO_TIMESTAMP(character-expression)
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +[[examples_of_to_timestamp]]
    +=== Example of TO_TIMESTAMP
    +
    +* This function returns the timestamp value '2016-12-07 10:01:00':
    ++
    +```
    +TO_TIMESTAMP ('2016-12-07 10:01:00')
    --- End diff --
    
    At first glance, I am guessing TO_TIMESTAMP() is alias to TO_TIME(), but it seems not.
So maybe it should explicitly mentioned that the character-expression must in fixed format
of YYYY-MM-DD HH24:MI:SS, and no milli-second part.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message