suppress time part of datetime value

(4 posts) (2 voices)

Tags:

No tags yet.

  1. Tim, Member

    As MS SQL server 2005 does not have a pure "date" datatype, i'm forced to use datetime columns.

    Is there any way to suppress output of the time part (which is 00:00:00 anyway) in myDBR reports and charts?

    Of course, i could just convert the column to a string using transact sql, but i fear that will break the sorting in myDBR.

  2. myDBR Team, Key Master

    You can use following formatting to simulate date and time datatypes missing in SQL Server 2005.

    select
    getdate() as 'Date column:type=date',
    getdate() as 'Time column:type=time'

    This will produce a date column with title 'Date column' and a time column with title 'Time column'.

    If you are on using sqlsrv-driver run the updater as we added this to sqlsrv-driver as well.

    --
    myDBR Team

  3. Tim, Member

    Thank you very much for your fast answer.

    While this is working fine for tabular reports, it unfortunately has no effect on charts, where my x-axis labels are still output with the full length :-(

    Or am i missing some other setting there?

    Edit: Ok, i think i found a working solution for me.
    i can just use a hidden column for sorting and convert the visible output column to my desired string format unsing tsql convert function.

  4. myDBR Team, Key Master

    For charts, you can just extract the date part from the datetime. Use convert-function to do this:

    select convert( char(10), mydatetime, 20), value
    from mydata

    --
    myDBR Team


Reply

You must log in to post.