473,396 Members | 1,713 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.

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 2628
* "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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
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.