Showing posts with label together. Show all posts
Showing posts with label together. Show all posts

Wednesday, March 21, 2012

datetime to date

Hi, everybody.
I have a parameter from datetime type.
Its' values are stored with date and time values together in the database.
But I only want to show its' date value to the user.
How can I do this?

You can modify the way a Datetime value is shown by adding the ToString() expression.

Take a look at the DateTime.ToString() reference: http://msdn2.microsoft.com/en-us/library/system.datetime.tostring.aspx

|||Thanks Jan.
But my parameter's value is not shown in the report.
So I can't write an expression or a method to this.( as Datetime.ToString() )
I think I should do this by SQL side.
But when I use a convert or cast function on sql side , there exists a type conflict.
Anyway, if you find a solution, share it with me please.|||

If you are using the datetime values as a parameter, the easiest way to do this is to create or modify your parameter query: add a column with only the date value of the other datetime values.

SELECT Date AS DBDate, CONVERT(VARCHAR(10), Date, 101) AS ViewDate
FROM <<Table>>

This query shows also the date in the format mm/dd/yyyy. Then use this query for the parameter: use the DBDate as Value and the ViewDate as label.

Friday, February 24, 2012

DATE's

Hi all,
I am trying to format some dates using datapart, my date format looks like
2005-06-13 00:00:00.000, I want the year and the month together to look like
200506, but the datepart's and conversts I have tried keep giving me 20056,
is there a way to add the '0' where it is needed.
Thanks in advance, PhilYou could use
select convert(char(6),getdate(),112)
and just replace getdate() with your date.
--
Adam J Warne, MCDBA
"Phil" wrote:

> Hi all,
> I am trying to format some dates using datapart, my date format looks like
> 2005-06-13 00:00:00.000, I want the year and the month together to look li
ke
> 200506, but the datepart's and conversts I have tried keep giving me 20056
,
> is there a way to add the '0' where it is needed.
> Thanks in advance, Phil|||Thanks for that, I think I was trying to make things more difficult than the
y
needed to be, been one of those days.
Thanks Phil
"Adam Warne" wrote:
> You could use
> select convert(char(6),getdate(),112)
> and just replace getdate() with your date.
> --
> Adam J Warne, MCDBA
>
> "Phil" wrote:
>