Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get local time in other countries
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01134752
Message ID:
01135538
Views:
32
Mike

Got the answer

See my reply to Tracy Holzer

Thanks for all your help

Colin

>Technically, this code sould recreate a cursor and reload the information from the site, this getting new information. But perhaps your cache is keeping the information.
>>Mike
>>
>>This is the code
>>
>>CREATE CURSOR WebPage (myMails m)
>>url="http://www.timeanddate.com/worldclock/full.html"
>>objHTTP = CreateObject("MSXML2.XMLHTTP")
>>objHTTP.Open("GET", url,.f.)
>>objHTTP.Send()
>>Insert into WebPage (myMails) VALUES (objHTTP.ResponseText)
>>objHTTP = .null.
>>
>>Am I missing something?
>>
>>Thanks
>>
>>Colin
>>
>>
>>>Are you missing a tableupdate() somewhere? What happens if you use the function as I suggested? With CREATE CURSOR...which would certainly not retain the previous information since the cursor is recreated everytime.
>>>
>>>>Mike
>>>>
>>>>I think we are talking at x purposes
>>>>
>>>>Let me give you an example - if I go on the web site at 5pm I get the local times relating to 5pm - if I start the program at the same time I get the same results
>>>>
>>>>Every time I look at the web site I get an update - but I could run the program after an interval of 30 minutes and still get the same information as I did at the beginning - however if I quit VFP and then run the program my times are up to date
>>>>
>>>>It's almost as if there is something prventing my program from finishing its coversation with the web site and reloading current information
>>>>
>>>>Colin
>>>>
>>>>>Of course. This is the way the site works. The site itself is updated every minute. So if you need get fresh information, you would need to poll the site again. Although if you are just looking for GMT offsets, this offset does not change, Montreal's offset is -5 (except during daylight savings time), so you only need to pickup the -5 once, no? If you need to poll the site often, put the function in a commandbutton.
>>>>>
>>>>>>Mike
>>>>>>
>>>>>>I parse the memo field looking for towns which are contained in a town and country table - works great - I then extract the date and time from the memo field and update the town information
>>>>>>
>>>>>>The next time I run - if I haven't exited VFP the times in the memo field are the same
>>>>>>
>>>>>>If I exit and restart I get an update
>>>>>>
>>>>>>Colin
>>>>>>
>>>>>>
>>>>>>>I don't see what you do with the information contained in the cursor. Do you parse the memo field and update something?
>>>>>>>
>>>>>>>>Mike
>>>>>>>>
>>>>>>>>I still have to exit VFP to be able to get the latest time
>>>>>>>>
>>>>>>>>This is the code - have I got it wrong
>>>>>>>>
>>>>>>>>clear
>>>>>>>>clear all
>>>>>>>>SET HOURS TO 24
>>>>>>>>set talk off
>>>>>>>>set exact on
>>>>>>>>
>>>>>>>>
>>>>>>>>CREATE CURSOR WebPage (myMails m)
>>>>>>>>set century on
>>>>>>>>*(content m)
>>>>>>>>url="http://www.timeanddate.com/worldclock/full.html"
>>>>>>>>objHTTP = CreateObject("MSXML2.XMLHTTP")
>>>>>>>>objHTTP.Open("GET", url,.f.)
>>>>>>>>objHTTP.Send()
>>>>>>>>Insert into WebPage (myMails) VALUES (objHTTP.ResponseText)
>>>>>>>>objHTTP = .null.
>>>>>>>>
>>>>>>>>Thanks
>>>>>>>>
>>>>>>>>Colin
>>>>>>>>
>>>>>>>>
>>>>>>>>>
objHTTP = .null.
>>>>>>>>>
>>>>>>>>>>Mike
>>>>>>>>>>
>>>>>>>>>>It works well but I have 1 last question - if I don't close the process I can't update the view without exiting VFP - how do I close it?
>>>>>>>>>>
>>>>>>>>>>Colin
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
CREATE CURSOR myWebPage (content m)
>>>>>>>>>>>url="http://www.timeanddate.com/worldclock/full.html"
>>>>>>>>>>>objHTTP = CreateObject("MSXML2.XMLHTTP")
>>>>>>>>>>>objHTTP.Open("GET", url,.f.)
>>>>>>>>>>>objHTTP.Send()
>>>>>>>>>>>Insert into myWebPage (content) VALUES (objHTTP.ResponseText)
>>>>>>>>>>>MODIFY MEMO myWebPage.content
>>>>>>>>>>>
>>>>>>>>>>>>Mike
>>>>>>>>>>>>
>>>>>>>>>>>>Sounds good but how do I code the internet query from VFP6?
>>>>>>>>>>>>
>>>>>>>>>>>>>Do a query on this internet site, parse the page and do the calculation. This page gives you the current date and time for most places in the world.
>>>>>>>>>>>>>http://www.timeanddate.com/worldclock/full.html
>>>>>>>>>>>>>
>>>>>>>>>>>>>>Local computer is based in the UK - it needs to know what the local time is in Chicago where the package is going
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Colin
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>Wouldn't the local computer where the application is installed know the offset to GMT?
>>>>>>>>>>>>>>>
On Error *
>>>>>>>>>>>>>>>lcComputer = "."
>>>>>>>>>>>>>>>loWMIService = Getobject("winmgmts:\\" + lcComputer + "\root\cimv2")
>>>>>>>>>>>>>>>colItems = loWMIService.ExecQuery("Select * from Win32_TimeZone")
>>>>>>>>>>>>>>>For Each loItem In colItems
>>>>>>>>>>>>>>>	?"Bias: " + transf(loItem.Bias)  && Offset in minutes
>>>>>>>>>>>>>>>	?"Caption: " + transf(loItem.Caption) && Description of the setting
>>>>>>>>>>>>>>>	?"Daylight Bias: " + transf(loItem.DaylightBias)  && Daylight savings time setting
>>>>>>>>>>>>>>>	?"Description: " + transf(loItem.Description) && Description of the setting
>>>>>>>>>>>>>>>	?
>>>>>>>>>>>>>>>Next
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>Or you can use the GETSYSTEMTIME() (GMT time) and make the diffence against the GETLOCALTIME() API to get the offset to GMT.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Hi
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>I have a database which contains information about packages to be delivered all over the world - I want to be able to find out the local time at destination without having to calculate it manually
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>So for example if I have a package to be delivered to Chicago I can automatically calulate that the time difference is 6 hours behind the UK
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Anyone ever done any work in this area?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Thanks
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Colin
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Reply
Map
View

Click here to load this message in the networking platform