how to find weekend from the date in vb.net

how to find weekend from the date in vb.net

23 Feb 2010 01:02:52
Hi Experts, Q: How to find date is week end in vb.net? A : It's simple {codecitation class="brush: vbnet; gutter: true;" width="700px"} Private Function IsWeekEnd(ByVal dateparam As DateTime) As Boolean If dateparam .DayOfWeek = DayOfWeek.Saturday OrElse dateparam .DayOfWeek = DayOfWeek.Sunday Then Return True End If Return False End Function {/codecitation} Thank you
Gold   Boarder
Posts: 156
From 03-Jun-2009
You're Points: 1106
Bookmark
Re:how to find weekend from the date in vb.net23 Feb 2010 01:02:52
Good can we Make it in SQl? how Regards Kirti Darji
Kirti.Darji.001
Expert  Boarder
Posts: 28
From 03-Jun-2009
You're Points: 538
Bookmark
Re:how to find weekend from the date in vb.net23 Feb 2010 01:02:52
Hi, Yes we can do in sql also. {codecitation class="brush: sql; gutter: true;" width="700px"} SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: RRaveen -- Create date: 04-10-2009 -- Description: Check a date is weekend , if it week end it will return 0 other wise it return the 1. -- ============================================= CREATE FUNCTION fncIsWeekEndDate ( -- Add the parameters for the function here @curDAte datetime ) RETURNS char(1) AS BEGIN declare @Return char(1) select @Return = case DateName(weekday,@curDAte) when 'Sunday' then '0' when 'Saturday' then '0' else '1' end RETURN @Return; END GO {/codecitation} If anyone have better than this way, Please share with us. Thank you
RRaveen
Gold  Boarder
Posts: 156
From 03-Jun-2009
You're Points: 1106
Bookmark
^ Scroll to Top