Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将RFC 3339日期时间转换为IST?_C_Curl_Google Drive Api_Google Drive Android Api_Clib - Fatal编程技术网

如何将RFC 3339日期时间转换为IST?

如何将RFC 3339日期时间转换为IST?,c,curl,google-drive-api,google-drive-android-api,clib,C,Curl,Google Drive Api,Google Drive Android Api,Clib,我正在使用Google drive rest API列出我的Google drive文件。我正在获取驱动器中文件的以下元数据。在这里,我得到了RFC3339格式的“创建时间”。 你能帮我把Google drive rest API返回的时间转换成IST吗?在Linux平台上有没有办法做到这一点 { "files": [ { "id": "1y_GB6OCBENf_gDMAzAHdN", "name": "testfile.jpg", "webViewLink": "htt

我正在使用Google drive rest API列出我的Google drive文件。我正在获取驱动器中文件的以下元数据。在这里,我得到了RFC3339格式的“创建时间”。 你能帮我把Google drive rest API返回的时间转换成IST吗?在Linux平台上有没有办法做到这一点

{
 "files": [
  {
   "id": "1y_GB6OCBENf_gDMAzAHdN",
   "name": "testfile.jpg",
   "webViewLink": "https://drive.google.com/file/d/1y_GB6OCBENf_gDMAzAHdN/view?usp=drivesdk",
   "createdTime": "2019-06-17T02:08:50.959Z"
   }
  ]
}

注意:我正在使用curl工具从我的Linux服务器访问Google drive rest API。

我知道您希望获得文件的创建日期,将其转换为IST并在代码中使用,但如果我错了,请更正我。 你可以这样做:

#!/bin/bash

your_date="2019-06-17T02:08:50.959Z"

#Remove the Z from the date
formatZ="${your_date//Z}"

#Replace the T with a space
formatT=$(echo $formatZ | tr T " ") 

#Use the command date to convert the date we formatted
newdate=$(TZ=IST date -d "$formatT UTC-5:30")

echo $newdate

您可以对使用
date
命令,然后对再次使用
date
命令。

请编辑您的问题并向我们展示您的尝试。API只会在时区内返回它,所以一旦你得到它,你必须自己隐藏它。是的,它是正确的。我们如何将其转换为IST?在Linux中,我们可以使用任何工具来实现这一点吗?要求我们推荐或查找书籍、工具、软件库、教程或其他非现场资源的问题对于堆栈溢出来说都是离题的,因为它们往往会吸引自以为是的答案和垃圾邮件。相反,请描述问题以及迄今为止为解决它所做的工作。嗨,Jescanellas,这是我所期望的,它在bash中运行良好。有什么方法可以用C语言处理这个时间转换吗?遗憾的是,我不喜欢C,但是这个例子可能对你有用:还有:有什么方法可以用Python而不是C来处理这个时间转换吗?我在谷歌上搜索了一些链接,但有点棘手。所以,我在这里问自己。