Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    5

    Unanswered: Extracting equivalent seconds from from "YYYY-MM-DD HH:MM"

    Hi All,

    I'm struggling to find out a way to extract seconds equivalent of hour and minutes from datetime as a query output, for example:

    fragment_col = '2010-05-26 14:30'


    So some thing like -->

    "select fragment_col from myTable where cond1=cond2"
    output: '2010-05-26 14:30'

    But expected output is 14*60+30=870

    Any help appreciated.

    Thanks
    Sahoo

  2. #2
    Join Date
    Sep 2008
    Posts
    5
    Any help on this please.

    Thanks
    Sahoo

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    After looking at the docs a little bit I can't find anything equivalent to an Hour() function, so you might have to tackle this a slightly harder way...

    the TO_CHAR() function will convert the datetime in to a string, then you will have to use string manipulation to extract the relevant time portions, convert these back to integers and apply the necessary math.

    Hope this helps
    George
    Home | Blog

Posting Permissions

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