Generate an RFC 3339 timestamp similar to Google Tasks API?

前端 未结 7 2191
时光取名叫无心
时光取名叫无心 2020-12-02 20:45

I am in the process of building an app that syncs with Google Tasks. As part part of the syncing, I want to compare the local task and the API task, and see which one has be

7条回答
  •  -上瘾入骨i
    2020-12-02 20:52

    If you are using Google Script, another option is to use Utilities.formatDate URL below:

    https://developers.google.com/apps-script/reference/utilities/utilities#formatDate(Date,String,String)

    Sample code from above URL:

    // This formats the date as Greenwich Mean Time in the format
    // year-month-dateThour-minute-second.
    var formattedDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'");
    

提交回复
热议问题