查询服务器时间
查询当前服务器时间信息。 所有服务器时间均以 UTC 标准提供。
调用信息
ServerTime(PlayNANOODelegate callback) {}
调用详细信息
| 参数 | 说明 | 类型 |
|---|---|---|
| callback | 通信结果 | PlayNANOODelegate |
源代码
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
plugin.ServerTime((state, message, rawData, dictionary) => {
if(state.Equals(Configure.PN_API_STATE_SUCCESS)) {
Debug.Log(dictionary["timezone"]);
Debug.Log(dictionary["timestamp"]);
Debug.Log(dictionary["ISO_8601_date"]);
Debug.Log(dictionary["date"]);
Debug.Log(dictionary["year"]);
Debug.Log(dictionary["month"]);
Debug.Log(dictionary["day"]);
Debug.Log(dictionary["hour"]);
Debug.Log(dictionary["minute"]);
Debug.Log(dictionary["second"]);
} else {
Debug.Log("Fail");
}
});
}
}
通信结果
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"code" : 200,
"message" : 0,
"value" : {
{
"timezone" : "String",
"timestamp" : "Integer",
"ISO_8601_date" : "String",
"date" : "String",
"year" : "String",
"month" : "String",
"day" : "String",
"hour" : "String",
"minute" : "String",
"second" : "String"
}
}
}
通信结果详细信息
| 数据键 | 说明 | 类型 |
|---|---|---|
| timezone | 时区信息 | string |
| timestamp | 从1970年1月1日0时0分0秒至今的秒数 | string |
| ISO_8601_date | ISO 8601 标准格式 | string |
| date | 默认日期格式 | string |
| year | 年份(4位数) | string |
| month | 月份(含0补位,2位数) | string |
| day | 日期(含0补位,2位数) | string |
| hour | 小时(含0补位,2位数) | string |
| minute | 分钟(含0补位,2位数) | string |
| second | 秒(含0补位,2位数) | string |