Solved

VFP 9 Current Time for Time Zone

Posted on 2013-01-19
4
968 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 42

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 42

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Activating an OLE Program 10 34
Cannot create an instance of OLE DB provider "VFPOLEDB" 3 614
FoxPro in WIndows 10 23 8,159
VFP9 options in the cloud (and elsewhere) 3 176
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…
Invest in your employees with these five simple steps to improve employee engagement and retention.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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