473,787 Members | 2,928 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateTime Hell

Trying to write an itinerary program.

Got date and time from date time picker
Converted it to date variables to extract the date and the time
The form has first a textbox displaying the starting date and time via the
picker.
The next few text boxes allow user input of hours and minutes for elapsed
time of occurring events
Each text box subtracts or adds from the previous box to reveal a new date
time

Example:
The start date is 9/9/2004 2:15:00 AM
I want to subtract 4 hours and 30 minutes (a changeable user input to a
textbox) from the start date and produce a new date time (which is converted
to a string and output to a display).

The problem: How can I get the minutes to borrow from the hours, and the
hours to borrow from the date when that is required.

Also, for the output display, is it typical to use a textbox or a label
control for output results?
Nov 21 '05 #1
10 1778
you don't have to do all that mess
use DateAdd , DateDiff, etc
--but if you're working from text boxes and trying to simulate what vb can
do -
you can use the integer division operator "\" and the "Mod" operator to
divide by 60 and get the remainder

"Dennis D." <te**@dennisys. com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Trying to write an itinerary program.

Got date and time from date time picker
Converted it to date variables to extract the date and the time
The form has first a textbox displaying the starting date and time via the
picker.
The next few text boxes allow user input of hours and minutes for elapsed
time of occurring events
Each text box subtracts or adds from the previous box to reveal a new date
time

Example:
The start date is 9/9/2004 2:15:00 AM
I want to subtract 4 hours and 30 minutes (a changeable user input to a
textbox) from the start date and produce a new date time (which is converted to a string and output to a display).

The problem: How can I get the minutes to borrow from the hours, and the
hours to borrow from the date when that is required.

Also, for the output display, is it typical to use a textbox or a label
control for output results?

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004
Nov 21 '05 #2
The textbox that gets the user input defaults to the system date unless I
clone the date from the date time picker and either add or subtract the
hours and minutes.

I'm still left with the question: How do I get vb to borrow from the parent
variable values?

All that mess is the form.

Thanks. Could use more input.

Here's a URL:
http://www.dennisys.com/physical_science/vb/dates.htm

ed.

"Hal Rosser" <hm******@bells outh.net> wrote in message
news:lJ******** **********@bign ews6.bellsouth. net...
you don't have to do all that mess
use DateAdd , DateDiff, etc
--but if you're working from text boxes and trying to simulate what vb can
do -
you can use the integer division operator "\" and the "Mod" operator to
divide by 60 and get the remainder

"Dennis D." <te**@dennisys. com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Trying to write an itinerary program.

Got date and time from date time picker
Converted it to date variables to extract the date and the time
The form has first a textbox displaying the starting date and time via the picker.
The next few text boxes allow user input of hours and minutes for elapsed time of occurring events
Each text box subtracts or adds from the previous box to reveal a new date time

Example:
The start date is 9/9/2004 2:15:00 AM
I want to subtract 4 hours and 30 minutes (a changeable user input to a
textbox) from the start date and produce a new date time (which is

converted
to a string and output to a display).

The problem: How can I get the minutes to borrow from the hours, and the
hours to borrow from the date when that is required.

Also, for the output display, is it typical to use a textbox or a label
control for output results?

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004

Nov 21 '05 #3

"Dennis D." <te**@dennisys. com> wrote in message
news:e1******** ********@TK2MSF TNGP11.phx.gbl. ..
The textbox that gets the user input defaults to the system date unless I
clone the date from the date time picker and either add or subtract the
hours and minutes.

I'm still left with the question: How do I get vb to borrow from the
parent
variable values?

All that mess is the form.

Thanks. Could use more input.


This is not as hard as you seem to be making it. Can you post the code that
you have tried?
Nov 21 '05 #4
Well, if it's not as hard as I have been making it, then what is the answer?
How do I get vb to borrow from the
parent variable values?
A simple answer will suffice.

Dennis D.

"Jeff Johnson [MVP:VB]" <i.***@enough.s pam> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..

"Dennis D." <te**@dennisys. com> wrote in message
news:e1******** ********@TK2MSF TNGP11.phx.gbl. ..
The textbox that gets the user input defaults to the system date unless I clone the date from the date time picker and either add or subtract the
hours and minutes.

I'm still left with the question: How do I get vb to borrow from the
parent
variable values?

All that mess is the form.

Thanks. Could use more input.
This is not as hard as you seem to be making it. Can you post the code

that you have tried?

Nov 21 '05 #5
On Mon, 9 Aug 2004 15:59:05 -0700, Dennis D. wrote:
Trying to write an itinerary program.

Got date and time from date time picker
Converted it to date variables to extract the date and the time
The form has first a textbox displaying the starting date and time via the
picker.
The next few text boxes allow user input of hours and minutes for elapsed
time of occurring events
Each text box subtracts or adds from the previous box to reveal a new date
time

Example:
The start date is 9/9/2004 2:15:00 AM
I want to subtract 4 hours and 30 minutes (a changeable user input to a
textbox) from the start date and produce a new date time (which is converted
to a string and output to a display).

The problem: How can I get the minutes to borrow from the hours, and the
hours to borrow from the date when that is required.

Also, for the output display, is it typical to use a textbox or a label
control for output results?


Dim n as datetime = datetime.now
dim m as datetime = n.subtract(new timespan(4, 30, 0))

console.writeli ne(n)
console.writeli ne(m)

HTH
--
Tom Shelton [MVP]
Nov 21 '05 #6
That worked!
Thanks Tom Shelton [MVP]

Elegance is simple.

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

"Tom Shelton" <to*@YOUKNOWTHE DRILLmtogden.co m> wrote in message
news:10******** *************** *******@40tude. net...
On Mon, 9 Aug 2004 15:59:05 -0700, Dennis D. wrote:
Trying to write an itinerary program.

Got date and time from date time picker
Converted it to date variables to extract the date and the time
The form has first a textbox displaying the starting date and time via the picker.
The next few text boxes allow user input of hours and minutes for elapsed time of occurring events
Each text box subtracts or adds from the previous box to reveal a new date time

Example:
The start date is 9/9/2004 2:15:00 AM
I want to subtract 4 hours and 30 minutes (a changeable user input to a
textbox) from the start date and produce a new date time (which is converted to a string and output to a display).

The problem: How can I get the minutes to borrow from the hours, and the
hours to borrow from the date when that is required.

Also, for the output display, is it typical to use a textbox or a label
control for output results?


Dim n as datetime = datetime.now
dim m as datetime = n.subtract(new timespan(4, 30, 0))

console.writeli ne(n)
console.writeli ne(m)

HTH
--
Tom Shelton [MVP]

Nov 21 '05 #7
Nak
> This is not as hard as you seem to be making it. Can you post the code
that
you have tried?


:-| Isn't that the nature of this group? For people are *are* finding
things hard to recevie advice from those in the know?

Nick.
Nov 21 '05 #8

"Dennis D." <te**@dennisys. com> wrote in message
news:u9******** *****@tk2msftng p13.phx.gbl...
Well, if it's not as hard as I have been making it, then what is the answer? How do I get vb to borrow from the
parent variable values?
A simple answer will suffice.


Hal's suggestion of using DateAdd() and/or DateDiff() was a simple answer.
Since you didn't seem to understand it, I figured you were completely lost
and I wanted to see what path you were going down. However, Tom's answer
seems to have done the trick. I just hope he didn't do your homework for
you.

People are in these groups to help of their own free will, and they'll be
quite happy to stop helping those who get snippy.
Nov 21 '05 #9

"Nak" <a@a.com> wrote in message
news:Og******** *****@TK2MSFTNG P09.phx.gbl...
This is not as hard as you seem to be making it. Can you post the code
that you have tried?


:-| Isn't that the nature of this group? For people are *are* finding
things hard to recevie advice from those in the know?


Absolutely. But Hal gave him an answer and he seemed to skip right past it.
Nov 21 '05 #10

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

Similar topics

22
2312
by: Jim Hubbard | last post by:
I am reposting a portion of a thread that I am involved in under a new topic because it seems that there are still people that believe the whole "DLL Hell" myth. I hope I can shed some light on this deception for some..... "Michael A. Covington" <look@ai.uga.edu.for.address> wrote in message news:%23tKbygELFHA.576@TK2MSFTNGP15.phx.gbl... > > "Jim Hubbard" <reply@groups.please> wrote in message
2
2173
by: Nad | last post by:
Hello, dll hell has been eliminated in .NET using assembly versioning. I am new in .NET and would like to know if there is any dll-hell-equivalent in .NET Windows or Web development environments that need to be addressed/aware of? Thank you.
55
9705
by: Jazzhouse | last post by:
Hi, How do you get the local date time as YYYYMMDDHHMMSS 14 digit string??? I am very new to C++, but if the MSDN tutorials are like that may be it is better to go with GCC... :) Ferhat
6
1561
by: Franck Diastein | last post by:
Hi, I'm soon finishing my first app, and I learned a lot :-) I'm still having trouble with dates... When I pull a date from SQL Server, I store it in a DateTime variable and when I want to display it I do this : _date.ToString("dd/MM/yyyy") and this works fine... But how do I asign to my DateTime _date variable a string entered by user aka 15/12/2004 ?
1
1726
by: GreatB | last post by:
Bill Gates died in a car accident. He found himself in Purgatory being sized up by God . .. "Well, Bill, I'm really confused on this call. I'm not sure whether to send you to Heaven or Hell. After all, you enormously helped society by putting a computer in almost every home in the world and yet you created that ghastly Windows 95. I'm going to do something I've never done before. In your case, I'm going to let you decide where you
6
8991
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference between date and datetime classes? Please, help
9
4929
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="urn:JadeWebServices/WebServiceProvider/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
4
6421
by: Michael Meckelein | last post by:
Hello, Wondering, if C# (framework 2.0) does not support parsing DateTime timezones in three letter acronyms. I would like to parse date strings like "2005 Nov 01 11:58:47.490 CST -6:00" but it seems C# does not support the timezone letters (CST). I suppose to use the symbol ZZZ for the timezone letters, but MSDE pointed out that it is not supported in C#, isn't it?
7
17075
by: sherifffruitfly | last post by:
Hi, God I hate datetime string formatting... How do I get a string of the form "04-Oct-2006", for example, from a DateTime object? Thanks a jillion, cdj
11
9840
by: Peter Holschbach | last post by:
Hi, I've the following line of code: result = DateTime.ParseExact("1999-12-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); where I get in result "result" "02.12.1999 00:59:59" instead of teh expected "01.12.1999 23:59:59" Anybody a idea ?
0
10363
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
10169
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
10110
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
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.