+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 (190 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 (3.6k points)
Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
134 questions
144 answers
55 comments
40 users