Formatted dates in a Google Apps script

前端 未结 3 351
抹茶落季
抹茶落季 2021-01-13 21:59

I\'m trying to get a spreadsheet with simple formatted dates when a form is submitted, but all dates, including the timestamp keep getting posted as \"Dec 31 1969 2:00PM\"..

3条回答
  •  一向
    一向 (楼主)
    2021-01-13 22:32

    I suggest review this:

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

    And the format patterns are these:

    http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

    And one example to help you

    Utilities.formatDate(thisFile.getLastUpdated(),"GMT-5", "yyyy/MM/dd, HH:mm:ss")

提交回复
热议问题