How to get date and Time from Real world?

0 votes
How to get the tim from server/internet or real world? I don't want that time is affected by End-User devices even they change the clock in their devices.
asked May 23, 2014 in App42 Cloud API-BaaS by antm.vn (45 points)

1 Answer

0 votes

Hi Antm.vm,

For getting the server time you can use our customCode Service in which you can write a code to get server time using Calendar and DateFormat.

It does not depend on End User device time.

answered May 24, 2014 by naresh (350 points)
any sample for Unity3D in C#?
thanks,
in unity3d you can get server time like this.

/// <summary>
       /// Finds the current time
       /// </summary>
       /// <returns>Time format</returns>
       public static String GetUTCFormattedTimestamp()
       {
           DateTime datTimeUTC = DateTime.Now.ToUniversalTime();
           DateTime dt = new DateTime(datTimeUTC.Year, datTimeUTC.Month, datTimeUTC.Day, datTimeUTC.Hour, datTimeUTC.Minute, datTimeUTC.Second, datTimeUTC.Millisecond);
           return String.Format("{0:yyyy-MM-dd'T'HH:mm:ss.fff'Z'}", dt);
       }
I tried this code before posting in here.
The code above will simply convert the local time (get by end-use devices) to UTC time.
So it will be definitely affected by end-use devices.
So you must use our custom code service for getting proper solution. I have given you custom code Documentation in above.
the doc is not much for Unity right now, huh Y_Y
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...