Solved

VFP 9 Current Time for Time Zone

Posted on 2013-01-19
4
960 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
After-hours service is a fact of life for most MSPs. While not the most pleasant aspect of the job, there are ways to make after-hours servicing a more profitable and organized enterprise.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

679 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