473,659 Members | 3,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculating time

If the input time (not the system time) in a textbox is 16:00 or 4 PM how do
I subtract 15 minutes and get 3:45 PM?

If the input time is 12:15 AM how do I subtract 30 minutes and get 11:45 PM?

As a side note: I began by parsing 16:00 and using timeserial() to produce
4:00 PM.

My output textboxes should read 3:45 PM and 11:45 PM respectively.

A simple description will do fine. I can write the code.

Thanks,

D.,
http://www.dennisys.com/
Nov 20 '05 #1
3 1142
"Dennis D." <te**@dennisys. com> schrieb
If the input time (not the system time) in a textbox is 16:00 or 4 PM
how do I subtract 15 minutes and get 3:45 PM?

If the input time is 12:15 AM how do I subtract 30 minutes and get
11:45 PM?

As a side note: I began by parsing 16:00 and using timeserial() to
produce 4:00 PM.

My output textboxes should read 3:45 PM and 11:45 PM respectively.

A simple description will do fine. I can write the code.


- Use Date.Parse or Date.ParseExact to convert from a string to a Date
- Use the methods of the Date object to add/subtract timespans
- Use the Date's ToString method to convert back to a string
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
CT
Convert to a DateTime object and use some of the built-in methods for your
calculation, such as the Subtract method using a TimeSpan.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Dennis D." <te**@dennisys. com> wrote in message
news:OB******** *****@TK2MSFTNG P10.phx.gbl...
If the input time (not the system time) in a textbox is 16:00 or 4 PM how
do
I subtract 15 minutes and get 3:45 PM?

If the input time is 12:15 AM how do I subtract 30 minutes and get 11:45
PM?

As a side note: I began by parsing 16:00 and using timeserial() to produce
4:00 PM.

My output textboxes should read 3:45 PM and 11:45 PM respectively.

A simple description will do fine. I can write the code.

Thanks,

D.,
http://www.dennisys.com/

Nov 20 '05 #3
Thank You. Thank You.
I'm on.
Slater Gaters.

"Dennis D." <te**@dennisys. com> wrote in message
news:OB******** *****@TK2MSFTNG P10.phx.gbl...
If the input time (not the system time) in a textbox is 16:00 or 4 PM how do I subtract 15 minutes and get 3:45 PM?

If the input time is 12:15 AM how do I subtract 30 minutes and get 11:45 PM?
As a side note: I began by parsing 16:00 and using timeserial() to produce
4:00 PM.

My output textboxes should read 3:45 PM and 11:45 PM respectively.

A simple description will do fine. I can write the code.

Thanks,

D.,
http://www.dennisys.com/

Nov 20 '05 #4

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

Similar topics

5
8799
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any feedback on how I might do things differently to make it either more consice, readable, or faster. ie... are there better ways to do it in Python? It won't break any records for calculating pi, that wasn't my goal, learning Python was. But it might...
0
2267
by: Kasp | last post by:
Hi there, I am trying to make an OLAP cube on a table having two columns (datetime, Number_of_times_an_event_occured). My dimension is time and I want to measure the Min and Max times an event occured over time. I have no problem in calculating Maximum occurance of events over time. However, I have some NULL values in my Number_of_times_an_event_occured column, due to which I don't see any result when I try to calculate
1
2373
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on this form. Any employee can have multiple entries in the table (key fields are EmpID and LeaveID) for multiple dates (John Doe can take 3 days annual leave, then take 3 days sick leave in any given month. I have a BeginningBalance of hours that...
3
5343
by: Miller | last post by:
Hi, Can someone tell me how to calculate MFLOPS for the following C# code (on a Pentium 4 2.0 Ghz)? for (i=0; i<n; i++) { for (j=0; j<n; j++) { for (k=0; k<n; k++)
12
2926
by: jUrner | last post by:
Hello all I have the problem of how to calculate the resolution of the system clock. Its now two days of head sratching and still there is nothing more than these few lines on my huge white sheet of paper stiring at me. Lame I know. import time
25
5009
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for learning advanced C.thx.
25
3195
by: Blaize | last post by:
Hi, I'm having an issue trying to calculate time. Its okay if the value does not exceed 24 hours otherwise I get a date and hours listed. For example, I have a loop which looks through a table and adds up the time spent. Dim TempCount As Date Dim DEVCount As Date Do TempCount = rst!wtime
10
5233
freddieMaize
by: freddieMaize | last post by:
Hi there, I need to hit few list of sites from my application and find the response time of those site and sort them (which ever is opening first will sit at the top). I have done the same using java (server side). Now my requirement is do in the client side (AJAX possibly). I’m having two challenges. Below is what I have done so far, <script> function call() { var d = new Date(); var xmlHttp;
3
1735
by: mfaisalwarraich | last post by:
Hi everybody. I have some problem while calculating time. i have employees who are working on hourly basis. i want to calculate the time. for example if an employee start working at 11:00pm (10-November-2008) and finish his job at 8:00am (11-November-2008) then how i can calculate the time between two different dates? i used dateDiffer method but it only displays the time difference between one date. please tell me how i can do this. thank you....
4
3931
by: Missionary2008 | last post by:
Thank you in advance for your help. I'm trying to calculate the Total Time in hours and minutes to complete a job. The way we are calculating it is by taking the Fee paid and dividing that by a 1:00. In Excel - Marsh is charged $90.00 (This is pre-determined) Her job is a $25.00/hour job (This is pre-determined) The Raw Hours to complete the job is 3.6 hours (I have this already in a qry) ...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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
8748
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
8531
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
7359
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
6181
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
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
1978
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.