Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am working on an application that will deal with dates and time 4

Status
Not open for further replies.

titoneon

MIS
Dec 11, 2009
335
US
Hi Everyone,
Happy new year for all
I am working on an application for Clock in and Clock out(vfp 9.0 spk1) and i want to dissable from the task bar and from the control panel "the date and time properties", on a few computers that will run the application, with the purposes of not allowing the user to cheat, to change the time and date using these options so some computers still running win 2000 pro, Win xp pro and win 7 pro so would like to know where to actually go to disable this ?
Thanks a lot in advance
Ernesto
 
Olaf,
Where can i find help to know how can i apply the time zone offset to GMT or what is the same what should be the sintax ?
Really appreciate if you can feed me that, i was searching vfp 9.0 sp2 help on the open command and i don't see that, just remember i am pretty new on this
Thanks a lot
Ernesto
 
Ernesto,

VFP doesn't have any native functions for adjusting for time zones. But this article shows a routine that will do it for you:


The routine gives you your offset, in minutes, from UTC. You just need to convert that to hours, and add it to the time returned by Olaf's code.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Despite daylight saving times the time zone offset is a constant. Several hours. You can look that up anywhere, google is your friend.

You can also find out the time zone programmatically, of course. But then again, that's something users may change at your client. It's your decision, if you want to hardcode this for that reason.

Bye, Olaf.
 
In VFP9 and in short all you need for the bias is:

Code:
DECLARE INTEGER GetTimeZoneInformation IN kernel32;
    STRING @ lpTimeZoneInformation
lcTimeZoneInfo = SPACE(172)
GetTimeZoneInformation(@lcTimeZoneInfo)
? CTOBIN(LEFT(lcTimeZoneInfo,4),"SR")

That bias is in minutes and the formula is local time = UTC/GMT time - bias.

And one inmportant detail: While there is a difference in GMT and UTC in daylight savings, the http request/response header definition says here GMT means the same as UTC.

Again, as the users might change this, you better either hard code the time zone offset or get it from some API or web service, where you can specify the local time zone. You are lost anyway, if you don't trust local system clock. Because if you don't trust the local system time, you also can't trust the time zone setting. Either you hard code the time zone name or make it a configuration, only people you trust may change and store it on a seperate file, which is readonly to normal users. I am just thinking along the lines of the paranoid admin.

Bye, Olaf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top