Help with date.addHours()

V

VR

Hi all, I'm sure I'm missing something while dealing with dates in my
code.... If anybody could give me a clue...

Here's the code:

dim dt1,dt2 as dateTime
dt1 = new dateTime(2006,1,1,22,0,0)
dt2 = dt1.addHours(3)

the problem is that I get always the same date in dt1 and dt2.

If I change the code to

dim dt1,dt2 as dateTime
dt1 = new dateTime(2006,1,1,22,0,0)
dt2 = dt1
dt2 = dt2.addHours(3)

I get the same results...


Shouldn't dt2 get the value of 1/2/2006 01:00?

Thanks a lot,
Regards,
Victor
 
M

Morten Wennevik

Hi Victor,

I can't reproduce your error. Are you sure you are reading the result
correctly?

Hi all, I'm sure I'm missing something while dealing with dates in my
code.... If anybody could give me a clue...

Here's the code:

dim dt1,dt2 as dateTime
dt1 = new dateTime(2006,1,1,22,0,0)
dt2 = dt1.addHours(3)

I get
dt1 = 01.01.2006 22:00:00
dt2 = 02.01.2006 01:00:00
the problem is that I get always the same date in dt1 and dt2.

If I change the code to

dim dt1,dt2 as dateTime
dt1 = new dateTime(2006,1,1,22,0,0)
dt2 = dt1
dt2 = dt2.addHours(3)

I get the same results...

I get
dt1 = 01.01.2006 22:00:00
dt2 = 02.01.2006 01:00:00
Shouldn't dt2 get the value of 1/2/2006 01:00?

You should, and I'm pretty sure you do too
 
V

VR

Sorry, I almost forgot the post....

Well, I really got surprised when I reboot my machine and everything went
fine again.

I should not say it is a framework or windows problem, I think the problem
is that I have a celeron 766 + 256MB running MSDE + VS.Net, building and
rebuilding the solution for 3 days without stopping or rebooting the
machine.... I think my machine just do not handle this kind of load....


sorry again...

Victor




Hi Victor,

I can't reproduce your error. Are you sure you are reading the result
correctly?

Hi all, I'm sure I'm missing something while dealing with dates in my
code.... If anybody could give me a clue...

Here's the code:

dim dt1,dt2 as dateTime
dt1 = new dateTime(2006,1,1,22,0,0)
dt2 = dt1.addHours(3)

I get
dt1 = 01.01.2006 22:00:00
dt2 = 02.01.2006 01:00:00
the problem is that I get always the same date in dt1 and dt2.

If I change the code to

dim dt1,dt2 as dateTime
dt1 = new dateTime(2006,1,1,22,0,0)
dt2 = dt1
dt2 = dt2.addHours(3)

I get the same results...

I get
dt1 = 01.01.2006 22:00:00
dt2 = 02.01.2006 01:00:00
Shouldn't dt2 get the value of 1/2/2006 01:00?

You should, and I'm pretty sure you do too
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top