Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2008

Tip: Looking for answers? Try searching our database.

get date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott - 21 Jul 2008 16:47 GMT
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?
Mark Rae [MVP] - 21 Jul 2008 16:55 GMT
> 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/library/system.datetime.addhours.aspx

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Scott - 21 Jul 2008 17:00 GMT
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.

>> 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
[quoted text clipped - 11 lines]
> structure:
> http://msdn.microsoft.com/en-us/library/system.datetime.addhours.aspx
Mark Rae [MVP] - 21 Jul 2008 17:11 GMT
[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
[quoted text clipped - 10 lines]
> 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...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Lloyd Sheen - 21 Jul 2008 17:22 GMT
> [top-posting corrected]
>
[quoted text clipped - 16 lines]
> 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
Scott - 21 Jul 2008 17:45 GMT
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.

> [top-posting corrected]
>
[quoted text clipped - 16 lines]
> Er, so how can you possibly know when the job ends if you don't know when
> it starts...?
Lloyd Sheen - 21 Jul 2008 18:25 GMT
> 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.
[quoted text clipped - 20 lines]
>> Er, so how can you possibly know when the job ends if you don't know when
>> it starts...?

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
bruce barker - 21 Jul 2008 18:27 GMT
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)

> 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.
[quoted text clipped - 24 lines]
> > Er, so how can you possibly know when the job ends if you don't know when
> > it starts...?
Mark Rae [MVP] - 21 Jul 2008 18:30 GMT
[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
[quoted text clipped - 19 lines]
> 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...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Scott - 21 Jul 2008 18:44 GMT
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

> [top-posting corrected again]
>
[quoted text clipped - 26 lines]
> 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...
akki - 22 Jul 2008 08:55 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.