BusinessObjects Board

Convert mm/dd/yyyy hh:ss:mm a to mm/dd/yyyy

I have a date dimesnion in universe which is of the format mm/dd/yyyy hh:mm:ss a, I’d like to convert the dimension to mm/dd/yyyy.
I use sql server as backend.

tried using Datepart(), is ther other function which gives me to mm/dd/yyyy


rnola (BOB member since 2006-03-26)

A Google would have helped

convert(varchar(10), [date_field], 101) 

.


haider :es: (BOB member since 2005-07-18)

Doing that converts into a char type. I was looking to truncate the hrs min and seconds part of the date and keeping it as a date type only so that i can use them back in webi as a date field for prompts


rnola (BOB member since 2006-03-26)

Right click on the object, choose object format.Select the format you want for your date.


rimpa :india: (BOB member since 2008-04-14)

kara re…it wasnt working for me


rnola (BOB member since 2006-03-26)

Try the following:

TRUNC(date)

Markus


Markus Lowry :us: (BOB member since 2007-03-30)

Markus,

This is an Oracle function where as he is using SQL Server. Unfortunatly, there is no direct equivalent to TRUNC() function within SQL Server . But there are ways this can be achieved. I did a little search and found the following link that might be of some help:


rimpa :india: (BOB member since 2008-04-14)

Theres no trunc function in sql server,

i tried doing this

CAST(CAST(YEAR(vRequestReportSummary.RequestDate) AS VARCHAR(4)) + ‘/’ +
CAST(MONTH(vRequestReportSummary.RequestDate) AS VARCHAR(2)) + ‘/’ +
CAST(DAY(vRequestReportSummary.RequestDate) AS VARCHAR(2)) AS DATETIME)

and that WORKED…

thanks bhupi


rnola (BOB member since 2006-03-26)

Sorry,

No where in your postin gdoes it state SQL as your DB.

Markus


Markus Lowry :us: (BOB member since 2007-03-30)

It does… in the 1st post itself.


rimpa :india: (BOB member since 2008-04-14)