473,976 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Calculate time

6 New Member
hi!! hello sir Madam,

Im currently a Computer Science Student year 3 my teacher give an assingment to create a program.. can you help me? ...my problem is how to calculate the time ...I'll used Combo box for start then another combo box for The end and textbox for the Total hour..what code Iwill use :

here the format of my program

cbo1.AddItem " 06:00 AM " and so on.. = starting time
cbo9.AddItem " 06:00 AM " and so on.. = end time
txt1.text = total hour

first condition// sample problem : what is the code
start = 07:00 PM
end = 11:00 AM
total hour = ?

2nd condition// sample problem : what is the code
start = 07:00 PM
end = ?
total hour = 3:30

last condition
start =?
end = 06:00 AM
total hour = 3:30


please help me

I need to make this so taht I can pass my subbject in proceed to the 4th year

Thank you very much...
Mar 16 '08 #1
6 1491
lotus18
866 Contributor
You can try DateAdd() function

Rey Sean
Mar 16 '08 #2
Killer42
8,435 Recognized Expert Expert
I'd suggest you also look into the DateDiff() function, which is specifically designed to calculate the differences between dates and/or times.

We can't do the work for you, though. See the following standard warning...


The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR
Mar 17 '08 #3
debasisdas
8,127 Recognized Expert Expert
Try to use DTPicker control instead of using combobox.

Use DateDiff function for the difference in time.
Mar 17 '08 #4
novercent
6 New Member
Try to use DTPicker control instead of using combobox.

Use DateDiff function for the difference in time.

thank you!! it helps me a lot !!!
Mar 17 '08 #5
novercent
6 New Member
I'd suggest you also look into the DateDiff() function, which is specifically designed to calculate the differences between dates and/or times.

We can't do the work for you, though. See the following standard warning...


The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR


I'll use Date different
my program works already to the 2 condition but but it will not work if the user will input first to the time

her is the format

hour = 2
start time = 05:00 AM
end time = ?


thank you...
Mar 17 '08 #6
Killer42
8,435 Recognized Expert Expert
I don't think I completely understand the latest question. But if you have a time and a number of hours to add to it, that's where the DateAdd() function would be used.
Mar 18 '08 #7

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

Similar topics

1
13613
by: sg_s123 | last post by:
============================================================================ 02-Feb-04 03-Feb-04 Staff Staff 0800hr- 1300hr- 1700hr- 1900hr- 0800hr- 1300hr- 1700hr- 1900hr- Number Name 1200hr 1700hr 1900hr 2200hr 1200hr 1700hr 1900hr 2200hr ============================================================================ 4654 Saniff A A A C A A A C 4437 Joey B C B C B C B C 4479 Elmer C C B C C C B C
7
16097
by: Tim Quon | last post by:
Hi Is there any function to get the current time so I can calculate the execution time of my code? What all is in the time.h and sys/times.h? Thanks Tim
6
4161
by: Herrcho | last post by:
in K&R Chapter 6.3 it mentions two methods to calculate NKEYS. and points out the first one which is to terminate the list of initializers with a null pointer, then loop along keytab until the end is found is less efficient than using sizeof operator , since size of the array is completely determined at compile time. i don't quite understand this. Could anyone explain to me in detail ?
4
6237
by: Qwert | last post by:
Hello, I do: Debug.WriteLine("A: " & DateTime.Now.Ticks.ToString) REM Calculate a bunch of stuff. Some loops and math functions. Debug.WriteLine("B: " & DateTime.Now.Ticks.ToString) but both A and B have the exact the same value. Is this method incorrect? When I make the function wait for 1 millisecond, A en B differ. Is there
1
2667
by: Bujji | last post by:
Hi, How to calculate Heap memory used by a process in HPUX machine (Itanium) using aCC compiler at run time ( My ultimate aim is to calculate heap memory at run-time and write it into a log file)? I couldn't find any parameter in pst_status structure that defines heap memory! ANy suggestions on how to calculate it? Thanks in advance.
5
2640
by: Michael | last post by:
Hi. I need dinamically calculate input text field based on parent static TD before showing content of input. Please, advice. Michael
5
13694
by: Beemer Biker | last post by:
I cant seem to get that date into any DateTime to make my calculation directly by subtracting "01-01-0000" from "now". After reading this: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11469&objectType=File I kluged up this routine that works: // convert date time into that funny matlab serial date time that starts at jan 1, 0000 private string DT2Matlab(DateTime thisDT)
2
2133
by: Lancelot | last post by:
Hello everyone. This is my first post here, but I've been looking for answer many time. I have a crazy idea in my head and since I am quite a newby to python, I am not sure where to start or if it's evenly possible. I wonder if you can calculate the time of respond of a wireless system to evaluate the distance of this device from the computer. I tought of a wireless mouse. Is there a even that you can send, check the local time, wait...
9
2489
by: brendanmcdonagh | last post by:
Hi, I am designing a project for my friend as I am just a week old baby to vb and want to implement what I've learnt so far. She wants to be able to put start time, end time and lunch for each day and then calculate amount of hours worked. So far I have designed form and added code to calculate textbox inputs, (which works!). However, I didn't think of this at beginning. Say I put .30 for lunch, when I get total hours worked the answer...
6
4116
by: rrstudio2 | last post by:
I am using the following vba code to calculate the median of a table in MS Access: Public Function MedianOfRst(RstName As String, fldName As String) As Double 'This function will calculate the median of a recordset. The field must be a number value. Dim MedianTemp As Double Dim RstOrig As Recordset Set RstOrig = CurrentDb.OpenRecordset(RstName, dbOpenDynaset)
0
10162
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11566
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8454
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.