[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-25。"],[],[],null,["# DateTime Formatting\n\n[DateTime](/workspace/gmail/markup/reference/types/DateTime) values are expected to be in the ISO 8601 format, for example '2013-02-14T13:15:03-08:00' (YYYY-MM-DDTHH:mm:ssZ).\n\nBelow are examples for generating ISO 8601 datetime strings in a few popular programing languages. \n\n### Java\n\n Date date = new Date();\n DateFormat df = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ssZ\");\n String dateAsISOString = df.format(date);\n\n### JavaScript\n\n var d = new Date();\n var date = d.toISOString();\n\n### PHP\n\n $objDateTime = new DateTime('NOW');\n $isoDate = $objDateTime-\u003eformat(DateTime::ISO8601);\n\n### Python\n\n from datetime import date\n d = date.now()\n date = d.isoformat()\n\n### Ruby\n\n require 'time'\n d = Time.now\n date = d.utc.iso8601\n\n### Perl\n\n my $now = time();\n $date = time2isoz($now);\n\n### C++\n\n time_t now;\n time(&now);\n char buf[sizeof \"2011-10-08T07:07:09Z\"];\n strftime(buf, sizeof buf, \"%FT%TZ\", gmtime(&now));"]]