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

I need some 'how to' on time/date strings please...

If I know that I have and ending date and time 2/18/04 and 06:00 am, how
can I take the current time and date 2/17/04 and 07:53 pm and do a
calculation that will show me how many days.hours.seconds are left?
Thanks,
Trint

.Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
4 786
Trint,

The DateTime class has many methods for doing date arithmetic. Have a look
at the msdn collection or your helpful on the DateTime class.

For example, there are several methods for add including
AddDays
Addhours
AddMilliseconds.

etc...

"Trint Smith" <tr********@hotmail.com> wrote in message
news:OG**************@TK2MSFTNGP12.phx.gbl...
If I know that I have and ending date and time 2/18/04 and 06:00 am, how
can I take the current time and date 2/17/04 and 07:53 pm and do a
calculation that will show me how many days.hours.seconds are left?
Thanks,
Trint

Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2
How about the easy way

Dim dt1 As DateTime = DateTime.Parse("2/18/04 06:00 AM")
Dim dt2 As DateTime = DateTime.Parse("2/17/04 07:53 PM")

Dim span As TimeSpan = dt1.Subtract(dt2)

Then take a look at TimeSpan, it will days, hours, minutes, etc.
HTH
Brian W


"Trint Smith" <tr********@hotmail.com> wrote in message
news:OG**************@TK2MSFTNGP12.phx.gbl...
If I know that I have and ending date and time 2/18/04 and 06:00 am, how
can I take the current time and date 2/17/04 and 07:53 pm and do a
calculation that will show me how many days.hours.seconds are left?
Thanks,
Trint

Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3
* Trint Smith <tr********@hotmail.com> scripsit:
If I know that I have and ending date and time 2/18/04 and 06:00 am, how
can I take the current time and date 2/17/04 and 07:53 pm and do a
calculation that will show me how many days.hours.seconds are left?


Have a look at 'Microsoft.VisualBasic.DateAndTime.DateDiff' and/or
subtract the dates:

\\\
Dim ts As TimeSpan = d1.Subtract(d2)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Thanks, I'll try this...and be back!
Trint

.Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5

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

Similar topics

4
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time...
3
by: Roel Castro | last post by:
Hello everyone, Could somebody help me how to open time/date item in Control panel by codes in access form modules? Taking in consideration the operating system which is Windows 98, Windows 2000...
7
by: arkobose | last post by:
hey everyone! i have this little problem. consider the following declaration: char *array = {"wilson", "string of any size", "etc", "input"}; this is a common data structure used to store...
12
by: arkobose | last post by:
my earlier post titled: "How to input strings of any lengths into arrays of type: char *array ?" seems to have created a confusion. therefore i paraphrase my problem below. consider the...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
2
by: richard | last post by:
I'm just dealing with a Roundup bug report in which it's pointed out that time.strftime() doesn't produce RFC2822-compliant date strings when in a locale other than "C". My reading of the RFC...
1
by: rija | last post by:
Hi folks, I need help regarding date and time comparison in PHP and MySQL My website is hosted in the USA (GMT - 8) And It is managed in Madagascar (GMT + 3) Want to consider DATE in Madagascar...
3
by: abctech | last post by:
I have an Html page, user enters a Date (dd-mm-yyyy) here. There's a servlet connected in the backend for processing this submitted information, it must have a method to compare this entered date...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.