Author |
Topic |
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-06-04 : 01:09:29
|
Hi all,How to find no of weeks in a month?RegardsSenthil.CSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-04 : 01:24:35
|
[code]select datepart(week, '2009-06-01') - datepart(week, '2009-06-30') + 1[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-06-04 : 01:30:56
|
Hey Thanks yar!Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-04 : 01:34:53
|
you can get begining and ending date of a month easily with declare @date datetimeselect @date = getdate()select dateadd(month, datediff(month, 0, @date), 0), dateadd(month, datediff(month, 0, @date) + 1, -1) KH[spoiler]Time is always against us[/spoiler] |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-06-04 : 02:00:14
|
quote: Originally posted by khtan you can get begining and ending date of a month easily with declare @date datetimeselect @date = getdate()select dateadd(month, datediff(month, 0, @date), 0), dateadd(month, datediff(month, 0, @date) + 1, -1) KH[spoiler]Time is always against us[/spoiler]
No problem dude now i'm using Mysql so i have built in function to get lastdate. LAST_DAY(date)Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-04 : 02:05:30
|
quote: i'm using Mysql
This is a MSSQL forum. Why don't you post in a MySQL forum, you will get better answer there. What we posted here may not work in MySQL. Who knows, maybe there is a getweeks() function in MySQL ? KH[spoiler]Time is always against us[/spoiler] |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-06-04 : 02:08:26
|
quote: Originally posted by khtan
quote: i'm using Mysql
This is a MSSQL forum. Why don't you post in a MySQL forum, you will get better answer there. What we posted here may not work in MySQL. Who knows, maybe there is a getweeks() function in MySQL ? KH[spoiler]Time is always against us[/spoiler]
Hi khtan,The response is not as fast as here in mysql forum!, then i have more exp in mssql then mysql.I convert the query according to Mysql.ThanksSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-04 : 02:11:38
|
Maybe it will be easier if you can convert your database from MySQL to MSSQL KH[spoiler]Time is always against us[/spoiler] |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-06-04 : 02:14:54
|
quote: Originally posted by khtan Maybe it will be easier if you can convert your database from MySQL to MSSQL KH[spoiler]Time is always against us[/spoiler]
Ya.. but my top management will take the decision...Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
|
|
|