{"id":15139,"date":"2022-11-04T12:00:19","date_gmt":"2022-11-04T03:00:19","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=15139"},"modified":"2022-11-04T13:02:24","modified_gmt":"2022-11-04T04:02:24","slug":"google-apps-scriptutilities-parsedate%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%a7%e6%96%87%e5%ad%97%e5%88%97%e3%81%8b%e3%82%89%e6%97%a5%e4%bb%98%e3%81%ab%e5%a4%89%e6%8f%9b%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=15139","title":{"rendered":"[Google Apps Script]Utilities.parseDate\u30e1\u30bd\u30c3\u30c9\u3067\u6587\u5b57\u5217\u304b\u3089\u65e5\u4ed8\u306b\u5909\u63db\u3059\u308b"},"content":{"rendered":"<p>Google Apps Script\u306eUtilities\u30af\u30e9\u30b9\u306b\u3001<a href=\"https:\/\/docs.oracle.com\/javase\/jp\/8\/docs\/api\/java\/text\/SimpleDateFormat.html\" title=\"SimpleDateFormat (Java Platform SE 8 )\" target=\"_blank\" rel=\"noopener\">Java SE\u306eSimpleDateFormat\u30af\u30e9\u30b9<\/a>\u306e\u4ed5\u69d8\u306b\u3057\u305f\u304c\u3063\u3066\u6307\u5b9a\u3057\u305f\u6587\u5b57\u5217\u3092\u65e5\u4ed8\u578b\u306b\u5909\u63db\u3059\u308b\u300c<span style=\"color: #ff0000; font-weight: bold;\">parseDate<\/span>\u300d\u30e1\u30bd\u30c3\u30c9\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/developers.google.com\/apps-script\/reference\/utilities\/utilities#parsedatedate,-timezone,-format\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=developers.google.com\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">Google Developers<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/06faae7b2719df835bb967d1f3c6ad4688c1d0f3f3b21432d63ec62e471e4d0d.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">Class Utilities \u00a0|\u00a0 Apps Script \u00a0|\u00a0 Google Developers<\/div><div class=\"lkc-url\" title=\"https:\/\/developers.google.com\/apps-script\/reference\/utilities\/utilities#parsedatedate,-timezone,-format\">https:\/\/developers.google.com\/apps-script\/reference\/utilities\/utilities#parsedatedate,-timezone,-format<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<p>\u4f7f\u3044\u65b9\u306f\u4e0a\u8a18\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306b\u3042\u308b\u901a\u308a\u3001\u65e5\u4ed8\u3068\u3057\u3066\u89e3\u6790\u3059\u308b\u6587\u5b57\u5217\u5024\u3068\u51fa\u529b\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u3001SimpleDateFormat\u30af\u30e9\u30b9\u306e\u4ed5\u69d8\u306b\u5f93\u3063\u305f\u65e5\u4ed8\u5f62\u5f0f\u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3068\u3057\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001\u65e5\u4ed8\u578b\u306e\u5024\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\/\/ This set of parameters parses the given string as a date in Greenwich Mean Time, formatted\r\n\/\/ as year-month-dateThour-minute-second.\r\nvar date = Utilities.parseDate(&quot;1970-01-01 00:00:00&quot;, &quot;GMT&quot;, &quot;yyyy-MM-dd' 'HH:mm:ss&quot;);\r\nLogger.log(date);<\/pre>\n<p><a href=\"https:\/\/developers.google.com\/apps-script\/reference\/utilities\/utilities#parsedatedate,-timezone,-format\" title=\"Class Utilities - Apps Script - Google Developers\" target=\"_blank\" rel=\"noopener\">https:\/\/developers.google.com\/apps-script\/reference\/utilities\/utilities#parsedatedate,-timezone,-format<\/a> \u3088\u308a<\/p>\n<p>\u3053\u308c\u307e\u3067\u6587\u5b57\u5217\u304b\u3089\u65e5\u4ed8\u306b\u5909\u63db\u3059\u308b\u969b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306bDate\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u6e21\u3059\u3053\u3068\u304c\u591a\u304b\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u4f8b\u3048\u3070\u5168\u89d2\u6587\u5b57\u304c\u542b\u307e\u308c\u308b\u6587\u5b57\u5217\u306e\u3088\u3046\u306b\u5909\u63db\u3067\u304d\u306a\u3044\u5834\u5408\u306f\u51e6\u7406\u304c\u5931\u6557\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">function myFunction() {\r\n  const str = '2022\uff0f12\uff0f31 12:34:56';\r\n  console.log(new Date(str)); \/\/Invalid Date\r\n  console.log(Utilities.parseDate(str, 'JST', 'yyyy\uff0fMM\uff0fdd HH:mm:ss')); \/\/Sat Dec 31 2022 12:34:56 GMT+0900 (Japan Standard Time)\r\n}<\/pre>\n<p>parseDate\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067\u610f\u56f3\u3057\u305f\u901a\u308a\u306b\u5909\u63db\u3067\u304d\u308b\u305f\u3081\u3001\u4eca\u56de\u306e\u6a5f\u80fd\u8ffd\u52a0\u306f\u5730\u5473\u306a\u304c\u3089\u3082\u975e\u5e38\u306b\u5f79\u7acb\u3064\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"Google Apps Script\u306eUtilities\u30af\u30e9\u30b9\u306b\u3001Java SE\u306eSimpleDateFormat\u30af\u30e9\u30b9\u306e\u4ed5\u69d8\u306b\u3057\u305f\u304c\u3063\u3066\u6307\u5b9a\u3057\u305f\u6587\u5b57\u5217\u3092\u65e5\u4ed8\u578b\u306b\u5909\u63db\u3059\u308b\u300cparseDate\u300d\u30e1\u30bd\u30c3\u30c9\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002  [&hellip;]","protected":false},"author":1,"featured_media":7113,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[[Google Apps Script]Utilities.parseDate\u30e1\u30bd\u30c3\u30c9\u3067\u6587\u5b57\u5217\u304b\u3089\u65e5\u4ed8\u306b\u5909\u63db\u3059\u308b]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[126],"tags":[],"class_list":["post-15139","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Google.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-3Wb","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/15139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15139"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/15139\/revisions"}],"predecessor-version":[{"id":15140,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/15139\/revisions\/15140"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7113"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}