Showing posts with label sep. Show all posts
Showing posts with label sep. Show all posts

Wednesday, March 7, 2012

DateTime ?

This is my table structure

Date(m/dd/yyyy)

9/09/2006

I want to select month and year in the below format .

Sep 2006 .

How to do that ?

Try this..

SELECT CONVERT(CHAR(6),GETDATE(),109)

|||

Sorry Raghu,

Try this..

SELECT LEFT(CONVERT(CHAR(11),GETDATE(),109),3) + ' ' + RIGHT(CONVERT(CHAR(11),GETDATE(),109),4)

|||

Or:

SELECT LEFT(DATENAME(month,'9/09/2006'),3) + ' ' + CONVERT(CHAR(4),Year('9/09/2006')) as DateYouwant

Saturday, February 25, 2012

dates on Page headers

Dates in database are

Ist july 2006
2 nd july 2006
1 st sep 2006

Group by state1

I need to get count of Application nos for Group by state1 and date should be in header for a week. we have to pass date range values from date_range parameter

How do get it. The format is given below:

Sat Sunday Monday .. Friday
Statename 1/7/2006 2/7/2006 3/7/2006 .. 7/7/2006
State1 2 5 7 6



If I do group by date, then dates will not appear in a horizontal manner, Please help me how to proceed furtherTry the cross-tab format for the report.

Rashmi|||cross tab shoul not be used as per the clients requirement

Tuesday, February 14, 2012

DateDiff

I am using DateDiff format like DATEDIFF(hour,Start,End) and it gave me the
result 12 hours.
Start:- 22 Sep 2006 09:30:00
End:- 22 Sep 2006 21:00:00
Is there any way it will return me 11.5 instead of 12 because it start from
9:30 and end at 21:00 so it must be 11.5 not 12 hours right...
Can any one guid me how I can solve this.
Thanks
No...it wouldn't really be 11.5. The first hour is 9 and the
second hour is 21. The difference between 9 and 21 is 12,
not 11.5. Your asking for the difference based on what
integer value is returned for the hour of the datetime value
you pass in.
Perhaps you want to find the difference in minutes and use
your own logic from there? What do you want to do if it's
9:01 and 21:00?
-Sue
On Wed, 27 Sep 2006 18:37:48 -0400, "Rogers"
<rogers@.hotmail.com> wrote:

>I am using DateDiff format like DATEDIFF(hour,Start,End) and it gave me the
>result 12 hours.
>Start:- 22 Sep 2006 09:30:00
>End:- 22 Sep 2006 21:00:00
>Is there any way it will return me 11.5 instead of 12 because it start from
>9:30 and end at 21:00 so it must be 11.5 not 12 hours right...
>Can any one guid me how I can solve this.
>Thanks
>
|||hi use this way so u will get the correct answer:
datediff(mi, from_time, to_time) / 60.00
ok got it
Rogers wrote:
> I am using DateDiff format like DATEDIFF(hour,Start,End) and it gave me the
> result 12 hours.
> Start:- 22 Sep 2006 09:30:00
> End:- 22 Sep 2006 21:00:00
> Is there any way it will return me 11.5 instead of 12 because it start from
> 9:30 and end at 21:00 so it must be 11.5 not 12 hours right...
> Can any one guid me how I can solve this.
> Thanks
|||Thanks
"samay" <sumi_r2@.rediffmail.com> wrote in message
news:1159408746.872297.16370@.h48g2000cwc.googlegro ups.com...
> hi use this way so u will get the correct answer:
> datediff(mi, from_time, to_time) / 60.00
> ok got it
> Rogers wrote:
>
|||hae it got worked? that date diff?