HighTechTalks DotNet Forums  

ERROR WHEN SETTING DATE

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss ERROR WHEN SETTING DATE in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
tony
 
Posts: n/a

Default ERROR WHEN SETTING DATE - 12-31-2007 , 12:14 PM






HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact 1.0

thanking in advance.



Reply With Quote
  #2  
Old   
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 12-31-2007 , 12:41 PM






How are you reading the date? DateTime.Now?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact 1.0

thanking in advance.





Reply With Quote
  #3  
Old   
tony
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 12-31-2007 , 12:52 PM



Hi,

till now i used DateTime.Now , after reading a little , i tried also
GetLocalTime
but it return the same wrong value of 1/1/2008.

very annoying.

any ideas ?

thanks for your help.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote

Quote:
How are you reading the date? DateTime.Now?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:flbbhs$432$1 (AT) news2 (DOT) netvision.net.il...
HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact 1.0

thanking in advance.







Reply With Quote
  #4  
Old   
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 12-31-2007 , 01:23 PM



It sounds like it's a timezone issue. The CF caches the current DateTime
(at least in 1.0 it did), so if you call out to set the time, DateTime.Now
will always be wrong from that point on. Without seeing code, I can't say
for sure what might be goping wrong though.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
Hi,

till now i used DateTime.Now , after reading a little , i tried also
GetLocalTime
but it return the same wrong value of 1/1/2008.

very annoying.

any ideas ?

thanks for your help.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:elrKUz9SIHA.1184 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
How are you reading the date? DateTime.Now?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:flbbhs$432$1 (AT) news2 (DOT) netvision.net.il...
HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact
1.0

thanking in advance.









Reply With Quote
  #5  
Old   
tony
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 12-31-2007 , 01:31 PM



except from SetLocalTime and GetLocalTime

i need to call other functions ?

how do i set the timezone, and to what value ?

i can build small program to test it and send the code, just tell me what to
test ? (SetLocalTime, GetLocalTime,DateTime.Now)

thanking in advance.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote

Quote:
It sounds like it's a timezone issue. The CF caches the current DateTime
(at least in 1.0 it did), so if you call out to set the time, DateTime.Now
will always be wrong from that point on. Without seeing code, I can't say
for sure what might be goping wrong though.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:flbdoo$9el$1 (AT) news2 (DOT) netvision.net.il...
Hi,

till now i used DateTime.Now , after reading a little , i tried also
GetLocalTime
but it return the same wrong value of 1/1/2008.

very annoying.

any ideas ?

thanks for your help.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:elrKUz9SIHA.1184 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
How are you reading the date? DateTime.Now?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:flbbhs$432$1 (AT) news2 (DOT) netvision.net.il...
HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact
1.0

thanking in advance.











Reply With Quote
  #6  
Old   
Paul G. Tobey [eMVP]
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 01-02-2008 , 09:48 AM



SetTimezoneInformation() will set the time zone (OpenNETCF has a wrapper for
this, too). Check what the Control Panel Date/Time applet says about the
time zone. Have you tried setting the date/time *that* way and seeing if it
works? That would point more-definitely to either a) your code is wrong, or
b) there is a time zone issue.

Paul T.

"tony" <daylor (AT) netvision (DOT) net.il> wrote

Quote:
except from SetLocalTime and GetLocalTime

i need to call other functions ?

how do i set the timezone, and to what value ?

i can build small program to test it and send the code, just tell me what
to test ? (SetLocalTime, GetLocalTime,DateTime.Now)

thanking in advance.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:OESFaK%23SIHA.5264 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
It sounds like it's a timezone issue. The CF caches the current DateTime
(at least in 1.0 it did), so if you call out to set the time,
DateTime.Now will always be wrong from that point on. Without seeing
code, I can't say for sure what might be goping wrong though.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:flbdoo$9el$1 (AT) news2 (DOT) netvision.net.il...
Hi,

till now i used DateTime.Now , after reading a little , i tried also
GetLocalTime
but it return the same wrong value of 1/1/2008.

very annoying.

any ideas ?

thanks for your help.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:elrKUz9SIHA.1184 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
How are you reading the date? DateTime.Now?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"tony" <daylor (AT) netvision (DOT) net.il> wrote in message
news:flbbhs$432$1 (AT) news2 (DOT) netvision.net.il...
HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact
1.0

thanking in advance.













Reply With Quote
  #7  
Old   
abhishek.nimonkar@gmail.com
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 01-03-2008 , 01:04 PM



Hi

I am facing a similar issue. Though my device works on windows CE 6.0
but i think the problem is related.
my device was also working fine since last few months but now from 1st
Jan, the date that is getting set is one day ahead of what i m trying
to set. the hours and minutes are getting set correctly.
I am using SetLocalTime to set the time. As suggested, i tried setting
the date using Date/Time applet in control panel, but the behaviour is
the same. I am also setting the timezone registry in platform.reg file
to set my timezone after every cold boot.

Any help is appreciated.
Thanks
Abhishek

Reply With Quote
  #8  
Old   
Paul G. Tobey [eMVP]
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 01-03-2008 , 01:42 PM



So, you're getting a different value from DateTime.Now than what you
actually see on the Date/Time Control Panel applet? Have you tried exiting
all .NET CF applications and restarting them to see if that changes? When
you set the date/time via the Control Panel to today, the current time, it
automatically is shifting the date around on you? That's not happening to
me (I don't have a CE6 device laying around, but it's working perfectly in
CE5). What time zone are you set for?

Paul T.

<abhishek.nimonkar (AT) gmail (DOT) com> wrote

Quote:
Hi

I am facing a similar issue. Though my device works on windows CE 6.0
but i think the problem is related.
my device was also working fine since last few months but now from 1st
Jan, the date that is getting set is one day ahead of what i m trying
to set. the hours and minutes are getting set correctly.
I am using SetLocalTime to set the time. As suggested, i tried setting
the date using Date/Time applet in control panel, but the behaviour is
the same. I am also setting the timezone registry in platform.reg file
to set my timezone after every cold boot.

Any help is appreciated.
Thanks
Abhishek



Reply With Quote
  #9  
Old   
abhishek.nimonkar@gmail.com
 
Posts: n/a

Default Re: ERROR WHEN SETTING DATE - 01-04-2008 , 12:04 AM



Thanks Paul for the reply. Please find the answers to your Questions.

-------you're getting a different value from DateTime.Now than what
you actually see on the Date/Time Control Panel applet?
No I see the same value in both the cases but it is different from
what I am setting. I am using GetLocalTime API.
-------Have you tried exiting all .NET CF applications and restarting
them to see if that changes?
Yes. I have restarted the device and applications and the problem is
still there.
------- When you set the date/time via the Control Panel to today, the
current time, it automatically is shifting the date aound on you?
Yes. If I set the date for today, it sets the date for tomorrow.
------- What time zone are you set for?
India Standard Time. There is no daylight saving in this time zone.

Code snippet.
//////////////////////////////////////////////////////////
SYSTEMTIME st,st1;
st.wYear = 2008;
st.wMonth = 1;
st.wDate = 4;
.....
.....
::SetLocalTime(&st);
::SetLocalTime(&st); // read somewhere that i need to do this twice.

::GetLocalTime(&st1);
printf("st1.wDay = %d\r\n",st1.wDay);// prints 5 here.
//////////////////////////////////////////////////////////

Thanks
Abhishek


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.