DateIssue

G

Guest

Hi Guys,

I have create a Date Object, with my specified date.
let me see:

DateTime dt = new DateTime(2007,03,03,07,30,00);
and I get the long ticks = dt.Ticks;
however when I create another DateTime instance by using that ticks,
DateTime clone = new DateTime(ticks);

It only return me year,month,day, the hour has been changed 12,and min is 00,

what is the issue?

Thanks
 
N

Neil Cowburn

I've just tried to verify this and I get the correct result, unlike the OP.

Here's my code:

using System;

static class Program
{
[MTAThread]
static void Main()
{
DateTime dt = new DateTime(2007, 03, 03, 07, 30, 00);
long ticks = dt.Ticks;

DateTime clone = new DateTime(ticks);
string parsed = clone.ToString();
} // Set BP here so that you can inspect 'parsed'
}

--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.

Managed Code in the Embedded World

http://www.opennetcf.com/
http://www.smartdeviceframework.com/
 
N

Nino Benvenuti

I tried Neil's code and received the correct result as well.

For the OP: On what platform and with which version of CF did you
experience the issue?


--
Nino Benvenuti
Device Application Development MVP
http://nino.net/blog


Neil Cowburn said:
I've just tried to verify this and I get the correct result, unlike the
OP.

Here's my code:

using System;

static class Program
{
[MTAThread]
static void Main()
{
DateTime dt = new DateTime(2007, 03, 03, 07, 30, 00);
long ticks = dt.Ticks;

DateTime clone = new DateTime(ticks);
string parsed = clone.ToString();
} // Set BP here so that you can inspect 'parsed'
}

--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.

Managed Code in the Embedded World

http://www.opennetcf.com/
http://www.smartdeviceframework.com/


jeff said:
Hi Guys,

I have create a Date Object, with my specified date.
let me see:

DateTime dt = new DateTime(2007,03,03,07,30,00);
and I get the long ticks = dt.Ticks;
however when I create another DateTime instance by using that ticks,
DateTime clone = new DateTime(ticks);

It only return me year,month,day, the hour has been changed 12,and min is
00,

what is the issue?

Thanks
 

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