Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time display
Message
 
To
08/11/2004 11:32:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00959211
Message ID:
00959295
Views:
9
There are several sites where you can find information about local time.
Just search GOOGLE for words like "time zone convertor". Each site will requere the separate approach. Here is an example from where you can borrow ideas.
do yLocalTime with "Moscow"

Procedure yLocalTime
LPARAMETERS lcCountry_or_City

clear
READYSTATE_COMPLETE =4
MAX_TIME =30

lcCountry_or_City=upper(lcCountry_or_City)

if not (type("oIE")="O" and not isnull(oIE))
	oIE = CreateObject("InternetExplorer.Application")
endif
oIE.visible=.t.

lcURL="http://www.timezoneconverter.com/cgi-bin/tzc.tzc"

lcURL=lower(lcURL)
oIE.Navigate(lcURL)

do while oIE.Readystate <> READYSTATE_COMPLETE
	wait wind time 1.0 ""
enddo

lcInnerText = upper(oIE.Document.Body.InnerText)


*case lcUrl="http://www.timezoneconverter.com/cgi-bin/tzc.tzc"
	* find Region designation
	ln=occur(lcCountry_or_City,lcInnerText)
	if ln<=0
		=messagebox("Country/City "+lcCountry_or_City+" not found!")
	else
		lcsubstr=substr(lcInnerText, at(lcCountry_or_City,lcInnerText)-1)		
		lcsubstr=left(lcsubstr,at("/",lcsubstr,2))
		lcRegion=strtran(lcsubstr,"/"+lcCountry_or_City,"")

		if not empty(lcsubstr) and not empty(lcregion)
			lcURL=lcURL+"?now=1&zone="+proper(lcRegion)+;
			+proper(lcCountry_or_City)+"&tozone=GMT"

			oIE.Navigate(lcURL)

			do while oIE.Readystate <> READYSTATE_COMPLETE
				wait wind time 1.0 ""
			enddo

			lcInnerText = oIE.Document.Body.InnerText
			lcmessage= left(lcInnerText, at("in "+proper(lcRegion),lcInnerText)-1)
			lcmessage=substr(lcmessage,rat(chr(13),lcmessage))
			
			lcheader=substr(lcInnerText, at("in "+proper(lcRegion),lcInnerText))
			lcheader="Current Time "+left(lcheader, at("convert",lcheader)-1)
			=messagebox(lcmessage,0, lcheader)
		endif
	endif
	
	
oIE.Quit
oIE=.NULL.
release oIE

return
>i need to display time of various countries on a page and also check what time it is in that country and validate accordingly.
>
>at present i am just taking the time difference between the origin country and the other countries to display the time and date.
>
>but is it possible that i link it to some website and update the time from a website which will accurately display the time and also keep track of daylight saving and other changes that can occur.
Previous
Reply
Map
View

Click here to load this message in the networking platform