Results 1 to 3 of 3

Thread: Date trimming

  1. #1
    Join Date
    Jun 2003
    Location
    Montreal
    Posts
    38

    Unanswered: Date trimming

    Hi,

    I have a query that looks like this:

    SELECT HIST_TIMESTAMP FROM mytable

    Here, HIST_TIMESTAMP is a DateTime variable. Now, what I'd like to have in my returned query is the date and the hour of the field but all minutes, seconds and the rest should be 0.

    For example, here's a sample of the data in 'mytable':

    HIST_TIMESTAMP
    --------------------
    2004-01-01 8:56:12
    2004-02-08 12:31:53

    Returned values from my query should be:
    2004-01-01 8:00:00
    2004-02-08 12:00:00

    How can I achieve this?

    Thanks,

    Skip.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    SELECT TO_CHAR(HIST_TIMESTAMP,'YYYY-MON-DD:HH24')||'00:00'
    FROM mytable;

  3. #3
    Join Date
    Jun 2003
    Location
    Montreal
    Posts
    38
    Seems to be working fine, thanks!

Posting Permissions

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