Help on Date time

  • i have A long date field (Date_in)

    like this

    14/11/2003 23:35 00:30

    --------------------------

    what i wont to do is take the long date field

    and

    split the DATE from the field

    like this

    dateA=14/11/2003

    and make a Time field

    like this

    dateB=23:35 00:30

    -------------

    all in one VIEW

    so thet i can get 5 field

    -----------------

    Date_in=14/11/2003 23:35 00:30

    DateA=14/11/2003

    DateB=23:35

    DateC=23:35 00:30

    DateE=00:30

    ---------------------------

    thnks ilan

  • The time you have given as an example looks strange. What format is it?

    For reqular datetime fields you can use the CONVERT statement and include a style parameter,

    eg:

    CONVERT(varchar(10), Date_in, 103) = dd/mm/yyy

    CONVERT(varchar(10), Date_in, 108) = hh:mm:ss

    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

  • ... or use one convert statement, and use substring to extract the part you want.

    eg select substring(convert(char(20),getdate(),113),13,8)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply