+ Reply to Thread
Results 1 to 3 of 3

Thread: using Derby database Timestamps intelligently

  1. #1

    Default using Derby database Timestamps intelligently

    In Derby, you cannot use functions like to_char or Convert or CAST when dealing with datetime and timestamp data types.

    Instead, we have extended our Derby repository with the following functions:
    format_timestamp and format_date.

    The syntax is as follows:
    select format_timestamp( column_name, 'format') as Column_alias:

    An example:
    select format_timestamp (START_TIME,'dd-MMM-yyyy') as RUN_DATE
    , format_timestamp (START_TIME,'yyyyMMdd') as SORTKEY
    from ...... where <CONDITION>

    Supported date formats-:
    Letter Date or Time Component Presentation Examples
    G Era designator Text AD
    y Year Year 1996; 96
    M Month in year Month July; Jul; 07
    w Week in year Number 27
    W Week in month Number 2
    D Day in year Number 189
    d Day in month Number 10
    F Day of week in month Number 2
    E Day in week Text Tuesday; Tue
    a Am/pm marker Text PM
    H Hour in day (0-23) Number 0
    k Hour in day (1-24) Number 24
    K Hour in am/pm (0-11) Number 0
    h Hour in am/pm (1-12) Number 12
    m Minute in hour Number 30
    s Second in minute Number 55
    S Millisecond Number 978
    z Time zone General time zone Pacific Standard Time; PST; GMT-08:00
    Z Time zone RFC 822 time zone -0800

  2. #2

    Default

    Hello,
    I tried using the function suggested by you in derby query, but i got an error saying format_timestamp not recognized.
    can you pls provide some more information which i am missing.

  3. #3

    Default

    As the thread states, our repository runs on Derby and we have extended the repository with our own built-in functions so this is only available as is to implementations where the Derby database contains our repository

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts