Solved

VFP 9 Current Time for Time Zone

Posted on 2013-01-19
4
924 Views
Last Modified: 2013-07-14
Hi all. I'm using VFP 9 SP1.

On a form I need the time and time zone displayed for my PC.

Next to the time display I need a drop-down that lists all available time zones. When a timezone is selected, the time displayed changes to the correct CURRENT time for that zone.

For example, I'm in CST. My PC clock shows 6:00 PM here. From the drop-down I select EST. The time displayed on the form should then show 5:00 PM and EST as the time zone.

However, since I believe daylight savings occurs at different times in different zones, it can't be a simple (take my time and subtract one hour). It would have to be some sort of lookup that actually checks to see what time it is in the new time zone. I hope that makes sense.

I realize this is probably difficult to implement in fp, but I am being told this is a must-have, and I'm not even sure where to begin.

Thanks!!!
0
Comment
Question by:formadmirer
  • 2
4 Comments
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 38796284
This should get you started: http://www.news2news.com/vfp/?example=73&function=106

Bye, Olaf.
0
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 333 total points
ID: 38796337
MS solved this already: http://support.microsoft.com/kb/194576

Google is even more helpful: http://www.google.com/#hl=cs&tbo=d&sclient=psy-ab&q=time+zone+foxpro&oq=time+zone+foxpro&gs_l=hp.3..0i8i30.1619.4147.0.4797.16.14.0.2.2.0.231.1691.5j8j1.14.0...0.0...1c.1.ns2qN7txidM&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&bvm=bv.41248874,d.d2k&fp=b61c7fb1a1fb209e&biw=1195&bih=601

This MSDN article (and links inside) can say more about time zones in Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724421(v=vs.85).aspx

To obtain the right time zone for your current location is almost impossible. You could derive it for computer IP but some networks topology is spread over several time zones. Wikipedia can help: http://en.wikipedia.org/wiki/List_of_time_zones_by_U.S._state

Daylight saving data are changed every year and you'll need to update them continuously. A good start is e.g. here: http://en.wikipedia.org/wiki/Daylight_saving_time
http://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States
0
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 333 total points
ID: 38796352
And the final solution: Based on your computer settings and the selected Time zone you have to calculate the difference between your computer time and the selected Time zone. You may add this difference to the DATETIME() and display the result on your form which has to be updated every second in some Timer event.

You could also think about internet atomic clock time and calculate the difference against it. More info is here: http://fox.wikis.com/wc.dll?Wiki~GetAtomicClockServerTime
0
 
LVL 12

Accepted Solution

by:
jrbbldr earned 167 total points
ID: 38796410
And if you have a MS SQL Server running you can just query the time and offset bias from it

Good Luck
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now