set time

Whing Dela Cruz
Whing Dela Cruz used Ask the Experts™
on
How to set time in in the specific country?
example philippines...
Is it possible to set time in specific country using vb6? via internet online connection?
My code is nDate = format$(now,"MMMM DD, YYYY")
Please give me Idea wether possible or not !
Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Our  timer zone available is   (GMT+8:00) Taipe
Retired
Top Expert 2012
Commented:
Your code will work whatever your regional settings.

Don't forget that there are standard settings that depend on your regional settings

e.g.
 format$(now,"Long Date)
GrahamSkanRetired
Top Expert 2012

Commented:
If you want to show the time in another zone, you could use:

Sub NewPlaceDate()
    Dim MyDateWrtGMT As Integer
    Dim HisDateWrtGMT As Integer
    
    MyDateWrtGMT = 8 'as you report
    HisDateWrtGMT = 1
    Dim GMT As Date
    GMT = DateAdd("h", -MyDateWrtGMT, Now)
    Debug.Print "HisDate " & DateAdd("H", HisDateWrtGMT, GMT)
End Sub

Open in new window

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Hi! GrahamSkan, I am leaving here in the philippines... And I want to have a vacation in USA possibly next month. So, when already there my loptop would propably changed the time.. I want to put a litle exe.file in my loptop using vb6 to to see the time of my country... Our time is exactly the same with Taipe. Is it Possible? If yes? how to get the time of taipe and apply it as format$(now," ") so that everytime I execute the exe.file It will give me the time of my country..

Author

Commented:
HI! This is the Standard Time Zone: GMT/UTC + 08:00 hour of my country. Can you tell me how to apply this base from the code you had shared to me?
GrahamSkanRetired
Top Expert 2012
Commented:
Hello ERWIIN,
I live in UK, so I am nowhere near either the  Philippines or the USA.

I think that you should use the +8 as MyDateWrtGMt in order to find the actual Greenwich Mean Time, and then to set the value of HisDateWrtGMT to difference between the public time of the place that you are going to and GMT.

Author

Commented:
Thanks to you GrahamSkan, I'll try it rigth now...
GrahamSkanRetired
Top Expert 2012

Commented:
OK. I'm interested to see if I've understood your question.

Author

Commented:
Thank you so much GrahamSkan, I'm now still going to develop the code since the result do not match the correct time...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial