+1 vote

Is there a way to retrieve the UTC time inside a program? I have noticed that when I save calendar::time into a variable, I am storing the user's time in whatever time zone they are.

by (160 points)

1 Answer

+1 vote

You can use *service to retrieve it from a site like http://worldclockapi.com/api/json/utc/now.

Here is how you would do it. In your program, use this code:

*service: utc
	*path: /
	*method: GET
	*success
		>>out_UTCtime = it["currentDateTime"]
	*error
		>>out_UTCtime = ""

and then you need to go to your program settings to configure the service:
1) On Settings>Services, click on "New service"
2) Fill the "Name" field with utc, and the "URL" field withhttp://worldclockapi.com/api/json/utc/now, leaving all the other fields blank
3) Click Save and the program is ready to run!

by (1.4k points)
Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
111 questions
118 answers
51 comments
310 users