Setting Date/Time for daylight savings using Opennetcf Ver 2.0

M

Manish Bafna

I am using opennetcf.windowsce namespace of Smart Device Framework 2.0 for
daylight savings.I was able to successfully
set timezone using SetTimeZoneInformation but i am not able to set Date/Time
using LocalTime and SystemTime of DatetimeHelper.I am not able to figure out
how to set bias/offset using LocalTime and SystemTime for daylight savings.I
would be grateful if somebody could provide complete working code for setting
date/time(with bias/offset) for daylight savings.
Any help would be highly appreciated.As it is urgent i would appreciate if
somebody can provide complete working code.
Thanks in advance for replying(as always)
 
F

Freesc

I am using opennetcf.windowsce namespace of Smart Device Framework 2.0 for
daylight savings.I was able to successfully
set timezone using SetTimeZoneInformation but i am not able to set Date/Time
using LocalTime and SystemTime of DatetimeHelper.I am not able to figure out
how to set bias/offset using LocalTime and SystemTime for daylight savings..I
would be grateful if somebody could provide complete working code for setting
date/time(with bias/offset) for daylight savings.
Any help would be highly appreciated.As it is urgent i would appreciate if
somebody can provide complete working code.
Thanks in advance for replying(as always)

hi~

i'm not using OpenNetCF but p/Invoke,this is the code that works

[DllImport("Coredll.dll", SetLastError=true)]
public static extern bool SetLocalTime(ref SystemTime
lpSystemTime);

public struct SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}

public void SetTime()
{

SystemTime systNew = new SystemTime();
SystemTime gtsystNew = new SystemTime();

systNew.wDay = 10;
systNew.wMonth = 8;
systNew.wYear = 2007;
systNew.wHour = 1;
systNew.wMinute = 0;
systNew.wSecond = 0;

SetLocalTime(ref systNew);
}
 
P

Paul G. Tobey [eMVP]

You don't set a bias or offset when you set the time; you just set the time.
If you call SetLocalTime(), that's the time, plain and simple. Doesn't care
what time zone is set or anything else; it's simply the time (it's like
setting the time on your watch). If you call SetSystemTime(), that's
setting GMT (or whatever you want to call it), so the time zone is used to
figure out what the local time actually is. *That* is then set.

Paul T.
 

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