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

datetime.addminutes

I am doing something wrong here but I cannot see it.

I have the following lines of code:

datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval)
WriteLog("NextNotificationDateTime is: " +
datNextNotificationDateTime.ToShortDateString)

So if I run the code line like this:

datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval)
(where intContactInterval = 15)

I get datNextNotificationDateTime as the exact same (unchanged, original)
Me.RunStartTime value. It does not appear to be adding 15 minutes.
(the WriteLog function is writing to the EventViewer application log.. this
is a service so I cannot throw an error and see it.)

Any ideas how this could be possible??
Nov 20 '05 #1
2 2623
* "Roger Twomey" <ro******@vnet.on.ca> scripsit:
So if I run the code line like this:

datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval)
(where intContactInterval = 15)

I get datNextNotificationDateTime as the exact same (unchanged, original)
Me.RunStartTime value. It does not appear to be adding 15 minutes.
(the WriteLog function is writing to the EventViewer application log.. this
is a service so I cannot throw an error and see it.)


Your code should work except that the number of minutes added to the
'DateTime' should be a 'Double' instead of an 'Integer'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Hi Roger,

In the code you presented RunStartTime is never changed so this statement:

datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval)

... always sets datNextNoficiationDateTime to the result of the value of
RunStartTime + 15 minutes. (The statement assigns the result of
Me.RunStartTime.AddMinutes(intContactInterval) to
datNextNotificationDateTime, it does not change the value of RunStartTime)

If you wish to leave RunStartTime's initial value alone, AddMinutes to
datNextNotificationDateTime instead:
datNextNotificationDateTime =
Me.datNextNotificationDateTime.AddMinutes(intConta ctInterval)
--
Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Roger Twomey" <ro******@vnet.on.ca> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
I am doing something wrong here but I cannot see it.

I have the following lines of code:

datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval) WriteLog("NextNotificationDateTime is: " +
datNextNotificationDateTime.ToShortDateString)

So if I run the code line like this:

datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval) (where intContactInterval = 15)

I get datNextNotificationDateTime as the exact same (unchanged, original)
Me.RunStartTime value. It does not appear to be adding 15 minutes.
(the WriteLog function is writing to the EventViewer application log.. this is a service so I cannot throw an error and see it.)

Any ideas how this could be possible??

Nov 20 '05 #3

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

Similar topics

15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
4
by: Elmar Jacobs | last post by:
hi guys, i try in this way c# System.DateTime actDateTime = CDocument.instance().getDateTime(); lastWarningDateTime = actDateTime; lastWarningDateTime.AddMinutes(6); if...
6
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...
1
by: Shapper | last post by:
Hello, I have this code line: Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, tbusername.Text, DateTime.Now, DateTime.Now.AddMinutes(30), True, reader.GetString(0),...
2
by: Roger Twomey | last post by:
I am doing something wrong here but I cannot see it. I have the following lines of code: datNextNotificationDateTime = Me.RunStartTime.AddMinutes(intContactInterval)...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
4
by: Mohan | last post by:
In the database, we are storing time in 3 columns: hours, Minutes and AM,PM. After retrieving it from the database, I want to load these values into a DateTime variable. I haven't had much...
4
by: sumip | last post by:
I just made a pretty strange observation with .NET 2.0 - DateTime.AddMilliseconds(double) and AddSeconds(double) seem to be broken: DateTime now = new DateTime(); DateTime t2 =...
1
by: =?Utf-8?B?Ym9iYnk=?= | last post by:
I have the folowing two proerties private DateTime _LastSyncDate = DateTime.Now private DateTime _ResyncMinutes; public DateTime LastSyncDate { get { return _LastSyncDate; } set {...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.