如何获取解析服务器DateTime? [英] How to get Parse Server DateTime?

查看:111
本文介绍了如何获取解析服务器DateTime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Parse中是否有一种方法可以让我获取服务器上正在运行的当前时间?我需要从服务器获取时间,而不依赖于本地设备的时钟.

Is there a method in Parse that would let me get the current time that is running on the server? I need to fetch the time from the server, and not depend on the local device's clock.

我正在使用C#,Unity SDK. TIA!

I'm using C#, Unity SDK. TIA!

推荐答案

您可以创建一个用javascript编写的云函数,该函数将获取日期并将其返回.

You can create a cloud function, written in javascript, which will get the date and return it.

Parse.Cloud.define("getServerTime", function(request, response) {
    var dateToday = new Date();
    response.success(dateToday.toDateString());
});

您可能希望对响应进行某种特定的格式化,以便您可以在客户端上合理地解析它.

You will likely want to do some specific formatting of the response so you can sensibly parse it on the client.

这篇关于如何获取解析服务器DateTime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆