Day of the Week function

DavidT_macktool

Well-known member
Joined
Oct 21, 2004
Messages
502
Location
Indiana
Programming Experience
3-5
I have an SQL dataset of time card records. I need to compute direct labor based on the "hours" value in this dataset.

I need a function - simple if statement that does this:

if (time card date) = saturday or sunday then
hours = hours * 1.5
end if

We pay overtime on weekends.

How do I determine if the Time Card Date is a Saturday or Sunday?

Thanks for reading,
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
If you have the Time Card Date in a Date Structure, you can use the DayOfWeek property and compare to a System.DayOfWeek enum.
Sample code (where dte is the Date):
VB.NET:
If dte.DayOfWeek = DayOfWeek.Saturday Or _
   dte.DayOfWeek = DayOfWeek.Sunday Then
 
Top Bottom