473,387 Members | 1,892 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,387 software developers and data experts.

get date

I have an application that allows the user to pick a start date, then the
enter in a number of hours to do a job, then a stop date fills out a
textbox. Is there a way to find out the stop date?
if they pick 7/11/08 and enter in 10 hours for a job, how can I figure out
the actual date the job should end?
Jul 21 '08 #1
10 2539
"Scott" <ii*@gmail.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
I have an application that allows the user to pick a start date, then the
enter in a number of hours to do a job, then a stop date fills out a
textbox. Is there a way to find out the stop date?
Yes.
If they pick 7/11/08 and enter in 10 hours for a job, how can I figure out
the actual date the job should end?
Depends what time the job starts. Does it start the moment the user presses
the button, or does it start at 00:00?

Anyway, all you really need is the AddHours(10) method of the DateTime
structure:
http://msdn.microsoft.com/en-us/libr....addhours.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #2
There is no particular time for the job to start. The user is only picking
the day which it will start and how many hours it will take to do the job.
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:ex**************@TK2MSFTNGP05.phx.gbl...
"Scott" <ii*@gmail.comwrote in message
news:uf**************@TK2MSFTNGP03.phx.gbl...
>I have an application that allows the user to pick a start date, then the
enter in a number of hours to do a job, then a stop date fills out a
textbox. Is there a way to find out the stop date?

Yes.
>If they pick 7/11/08 and enter in 10 hours for a job, how can I figure
out the actual date the job should end?

Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

Anyway, all you really need is the AddHours(10) method of the DateTime
structure:
http://msdn.microsoft.com/en-us/libr....addhours.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #3
"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected]
>>I have an application that allows the user to pick a start date, then
the enter in a number of hours to do a job, then a stop date fills out a
textbox. Is there a way to find out the stop date?

Yes.
>>If they pick 7/11/08 and enter in 10 hours for a job, how can I figure
out the actual date the job should end?

Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

There is no particular time for the job to start. The user is only picking
the day which it will start and how many hours it will take to do the job.
Er, so how can you possibly know when the job ends if you don't know when it
starts...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #4
Mark Rae [MVP] wrote:
"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected]
>>>I have an application that allows the user to pick a start date,
then the enter in a number of hours to do a job, then a stop date
fills out a textbox. Is there a way to find out the stop date?

Yes.

If they pick 7/11/08 and enter in 10 hours for a job, how can I
figure out the actual date the job should end?

Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

There is no particular time for the job to start. The user is only
picking the day which it will start and how many hours it will take to
do the job.

Er, so how can you possibly know when the job ends if you don't know
when it starts...?

Another possible problem is how many hours will the person work each
day. A job which takes 10 hours where the person works one hour a day
will have a much different end date than one where the person works a
7.5 hour work day.

To me the three details that would be necessary are start date, end date
and hours to complete the job.

Just my two cents.
LS
Jul 21 '08 #5
Its not a job such as a sql job, or anything like that, its a repair job on
a car so time isn't a factor only the number of days.

so if the user body guy enters in a start date of 7/11/2008 and enters in
the number of hours its going to take to do each task, prep, paint, etc.
such as a total of 8 hours, then they should see an end date of 7/12/2008
and so on.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:e4**************@TK2MSFTNGP03.phx.gbl...
"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected]
>>>I have an application that allows the user to pick a start date, then
the enter in a number of hours to do a job, then a stop date fills out
a textbox. Is there a way to find out the stop date?

Yes.

If they pick 7/11/08 and enter in 10 hours for a job, how can I figure
out the actual date the job should end?

Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

There is no particular time for the job to start. The user is only
picking the day which it will start and how many hours it will take to do
the job.

Er, so how can you possibly know when the job ends if you don't know when
it starts...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #6
Scott wrote:
Its not a job such as a sql job, or anything like that, its a repair job on
a car so time isn't a factor only the number of days.

so if the user body guy enters in a start date of 7/11/2008 and enters in
the number of hours its going to take to do each task, prep, paint, etc.
such as a total of 8 hours, then they should see an end date of 7/12/2008
and so on.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:e4**************@TK2MSFTNGP03.phx.gbl...
>"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected]
>>>>I have an application that allows the user to pick a start date, then
the enter in a number of hours to do a job, then a stop date fills out
a textbox. Is there a way to find out the stop date?
Yes.

If they pick 7/11/08 and enter in 10 hours for a job, how can I figure
out the actual date the job should end?
Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?
There is no particular time for the job to start. The user is only
picking the day which it will start and how many hours it will take to do
the job.
Er, so how can you possibly know when the job ends if you don't know when
it starts...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Is this for a real application? Your example seems to go against what
you are saying. A job that takes lets say 10 hours, if there is prep
painting etc., the drying of the paint must occur prior to other steps
so the number of hours is not indicative of the time to do the job. And
what happens when an 'emergency' job comes in and the person/people
required to do the job are busy with other work.

Most jobs like this are charged by worktime not by the time the job will
be finished.

LS
Jul 21 '08 #7
so you take the number of hours, divide by max hours a day, to get number of
days. then add to start date. you may need to take into account non-working
days (sunday, holidays, etc).

-- bruce (sqlwork.com)
"Scott" wrote:
Its not a job such as a sql job, or anything like that, its a repair job on
a car so time isn't a factor only the number of days.

so if the user body guy enters in a start date of 7/11/2008 and enters in
the number of hours its going to take to do each task, prep, paint, etc.
such as a total of 8 hours, then they should see an end date of 7/12/2008
and so on.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:e4**************@TK2MSFTNGP03.phx.gbl...
"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected]
>>I have an application that allows the user to pick a start date, then
the enter in a number of hours to do a job, then a stop date fills out
a textbox. Is there a way to find out the stop date?

Yes.

If they pick 7/11/08 and enter in 10 hours for a job, how can I figure
out the actual date the job should end?

Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

There is no particular time for the job to start. The user is only
picking the day which it will start and how many hours it will take to do
the job.
Er, so how can you possibly know when the job ends if you don't know when
it starts...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Jul 21 '08 #8
"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected again]
>>>>I have an application that allows the user to pick a start date, then
the enter in a number of hours to do a job, then a stop date fills out
a textbox. Is there a way to find out the stop date?

Yes.

If they pick 7/11/08 and enter in 10 hours for a job, how can I figure
out the actual date the job should end?

Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

There is no particular time for the job to start. The user is only
picking the day which it will start and how many hours it will take to
do the job.

Er, so how can you possibly know when the job ends if you don't know when
it starts...?

so if the user body guy enters in a start date of 7/11/2008 and enters in
the number of hours its going to take to do each task, prep, paint, etc.
such as a total of 8 hours, then they should see an end date of 7/12/2008
and so on.
That makes no sense...

A day isn't 8 hours long. If I start work at 8am on 11th and work for 8
hours, that doesn't make it 12th...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #9
Trust me guys, I have a boat load of questions to the business folks that
own the orginal application. This app is done in Excel and they wanted it
web enabled to use in more of their body shops.

Currently if the app says it takes 16 hours to complete a job, the app shows
4 days of work time on it, 4 days an hour, so for example in the current app
if the repair guy enters in a date of

7/22/2008
16 hours of total work time
the app shows 4 days
and an estimated done date is 7/25/08

unless there is a weekend involved then it calculates them and would move
over to the following week.

So if the start date was 7/24/2008 then the app would show
16 hours of work time
4 days to complete
est done date would be 7/30/2008
and then show 4 weekdays and 2 weekend days

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Oy**************@TK2MSFTNGP04.phx.gbl...
"Scott" <ii*@gmail.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...

[top-posting corrected again]
>>>>>I have an application that allows the user to pick a start date, then
>the enter in a number of hours to do a job, then a stop date fills
>out a textbox. Is there a way to find out the stop date?
>
Yes.
>
>If they pick 7/11/08 and enter in 10 hours for a job, how can I
>figure out the actual date the job should end?
>
Depends what time the job starts. Does it start the moment the user
presses the button, or does it start at 00:00?

There is no particular time for the job to start. The user is only
picking the day which it will start and how many hours it will take to
do the job.

Er, so how can you possibly know when the job ends if you don't know
when it starts...?

so if the user body guy enters in a start date of 7/11/2008 and enters in
the number of hours its going to take to do each task, prep, paint, etc.
such as a total of 8 hours, then they should see an end date of 7/12/2008
and so on.

That makes no sense...

A day isn't 8 hours long. If I start work at 8am on 11th and work for 8
hours, that doesn't make it 12th...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #10
I think u have solution ready made with you.

requirement 1: No of hours which make one working day = 4hrs
requirement 2: Should not include weekends.

so you can get number of work day = total works hours/1 working day
(in hrs)

end day = start day + number of work days

that is it you are done.

For finding weekend you can use DayOfWeek enum
Jul 22 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
9
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think...
30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
3
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
1
by: Liz Malcolm | last post by:
Hello and TIA. I have a DE form with an option group that if daily is selected todays date is used for start and end date, if weekly is selected Monday - Friday is used. I am trying to add a...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
3
by: JJ | last post by:
Here's the code. $link="http://xbox360cheat.org"; $close_date=$_POST; #last content change check if ($close_date == 0) $close_date = date("Y-m-d H:m:s", mktime(12, 0, 0, date("m"), date...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.