Results 1 to 6 of 6

Thread: DateTime Issue

  1. #1
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212

    Unanswered: DateTime Issue

    How do I exclude showing the seconds out of a datetime column?
    I tried converting it to smalldatetime but it only rounds it up to "00".

    e.g.

    2004-01-03 16:33:20

    I want to show only:
    2004-01-03 16:33


    I know this can be achive by using Datepart function calling each
    part of the datetime, but is there a simplier way?

    Basically the datetime value will be shown to a ASP page. And I don' t want to show until seconds.
    Last edited by Patrick Chua; 01-04-04 at 23:45.
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Have you tried to cast/convert it to a varchar ?

  3. #3
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    ooh...thanks...,
    err...what if I want it to remain showing numbers instead of the date names?
    Cast/convert will change the datetime column into date names
    e.g. JAN,FEB...etc.....
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  4. #4
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    Like ....
    Code:
    convert(varchar(16),datecol,121)
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  5. #5
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    Thanks..that was a fast response.
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  6. #6
    Join Date
    Feb 2002
    Posts
    2,232
    When you need to change the format of the date - look in bol under "Cast and Convert", it will show you the formats that enigma references.

Posting Permissions

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