473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Find day of date in asp.net

hi,

I am giving two dates as input.Iwant to calculate the number of days between those days except sundays.How can i do it..

Help me..
Jul 18 '07 #1
1 1325
Plater
7,872 Expert 4TB
If you can convert them both to DateTime objects, you can subtract one from the other to create a TimeSpan object. TimeSpan has method for returning the number of days it occupies.
That will give you total days.
Divide by 7 and take the integer portion, to get number of whole weeks. that also gives the number of sundays with an error of +/- 1.
OR:
Start at the first date and itterate up to the last date by adding a Day .AddDays(1) and checking to see if each day is a sunday, if not, itterate a number of days counter: NumDays++
Jul 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gleep | last post by:
Hey Guys, I've got a table called Outcomes. With 3 columns and 15 rows 1st col 2nd col 3rdcol outcome date price There are 15 rows...
17
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). ...
67
by: PC Datasheet | last post by:
Transaction data is given with date ranges: Beginning End 4/1/06 4/4/06 4/7/06 4/11/06 4/14/06 4/17/06 4/18/06 4/21/06 426/06 ...
1
by: alan_conoco | last post by:
Hello all, I have a table looks like this in Access Product Sale Date A date A date A date B date B ...
23
by: thebjorn | last post by:
For the purpose of finding someone's age I was looking for a way to find how the difference in years between two dates, so I could do something like: age = (date.today() - born).year but that...
1
by: GoDogGo | last post by:
I need code to find next Tuesdays date. I have started with this: TuesdaysDate = DateAdd("d", vbTuesday - Weekday(Date), Date) However if today is Wednesday it returns yesterdays date. I...
1
by: shafq7 | last post by:
Hello Iam trying to find a date from table "taqrir" matching to date in unbound text box in form by this code as below: Private Sub cmdAppend_Click() Dim dbs As Database Dim rs As...
1
by: todashah | last post by:
Hi ! I face a problem regarding to find numbers of days beetween to days in c #. I have write following code. DateTime dt=DateTime.now; DateTime dtr=Convert.ToDateTime(textbox1.text); TimeSpan...
5
by: Greg (codepug | last post by:
I have a table that contains a field called RDATE (reminder date). Dates are optionally entered to remind a user of an upcoming event. I have a reminder button that launches a popup form, and a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.