LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Only date value returned from datetime field

    Employee
    Posted 07-13-2011 21:39

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: pspang78

    Hi there,

    A table in SQL Server contains a datetime field (eg datetime stamp). When using JDBC Query, it only returns the date value and omits the time. How do I return the date and time from SQL Server?

    Regards,
    William


  • 2.  RE: Only date value returned from datetime field

    Employee
    Posted 07-14-2011 02:27

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mgajdosik

    Hi,

    unfortunately you need to be more precise in your query.

    "Select * from table" will return only dates from timestamps. So you will have to specify the format of the datetime you want to be returned.

    in example

    TO_CHAR( COLUMN_NAME,'DD-MON-RRRR HH24:MI:SS' )

    I know that this can be a bit annoying, especially when you want to pull all the fields from the db, but this is how it works

    Marek