공지사항:
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증해야 합니다.
ee.Date.format
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
날짜를 문자열로 변환합니다.
사용 | 반환 값 |
---|
Date.format(format, timeZone) | 문자열 |
인수 | 유형 | 세부정보 |
---|
다음과 같은 경우: date | 날짜 | |
format | 문자열, 기본값: null | http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html에 설명된 패턴입니다. 생략하면 ISO 표준 날짜 형식이 사용됩니다. |
timeZone | 문자열, 기본값: null | 시간대입니다 (예: 'America/Los_Angeles'); 기본값은 UTC입니다. |
예
코드 편집기 (JavaScript)
// Various examples of ee.Date.format with Joda-Time formatting and time zones.
var date = ee.Date('2020-08-18'); // Defaults to UTC
print(date); // Date (2020-08-18 00:00:00)
// List of time zones:
// https://www.joda.org/joda-time/timezones.html
print(date.format(null, 'GMT')); // 2020-08-18T00:00:00
print(date.format(null, 'Etc/GMT')); // 2020-08-18T00:00:00
print(date.format(null, 'Etc/GMT+0')); // 2020-08-18T00:00:00
print(date.format(null, 'Zulu')); // 2020-08-18T00:00:00
print(date.format(null, 'UTC')); // 2020-08-18T00:00:00
print(date.format(null, 'America/Los_Angeles')); // 2020-08-17T17:00:00
print(date.format(null, 'US/Pacific')); // 2020-08-17T17:00:00
print(date.format(null, 'Etc/GMT+8')); // 2020-08-17T17:00:00
print(date.format(null, 'PST8PDT')); // 2020-08-17T17:00:00
print(date.format(null, 'Australia/Tasmania')); // 2020-08-18T10:00:00
print(date.format(null, 'Etc/GMT-10')); // 2020-08-18T10:00:00
// Reference for Joda-Time format characters:
// https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
var datetime = ee.Date('1975-07-23T21:13:59'); // Defaults to UTC
print(datetime); // Date (1972-07-25 21:13:59)
// year of era and era
print(datetime.format('YYYY GG')); // 1975 AD
// century and year
print(datetime.format('CC YY')); // 19 75
// weekyear and week of weekyear
print(datetime.format('xxxx ww')); // 1975 30
// year and day of year
print(datetime.format('yy DDD')); // 75 204
// month of year and day of month
print(datetime.format('MM dd')); // 07 23
// day of week number and day of week text
print(datetime.format('e E')); // 3 Wed
print(datetime.format('e EEEEEEEE')); // 3 Wednesday
// half of day, hour of halfday, and clockhour of halfday
print(datetime.format('a K h')); // PM 9 9
print(datetime.format('a KK hh')); // PM 09 09
// hour of day, clockhour of day, minute, second, fraction of second
print(datetime.format('H k m s S')); // 21 21 13 59 0
print(datetime.format('HH kk mm ss SS')); // 21 21 13 59 00
// time zone
print(datetime.format('z')); // UTC
print(datetime.format('zzzz')); // Coordinated Universal Time
print(datetime.format('z', 'PST8PDT')); // PDT
print(datetime.format('zzzz', 'PST8PDT')); // Pacific Daylight Time
// time zone offset/id
print(datetime.format('Z')); // +0000
print(datetime.format('ZZ')); // +00:00
print(datetime.format('ZZZ')); // UTC
print(datetime.format('Z', 'PST8PDT')); // -0700
print(datetime.format('ZZ', 'PST8PDT')); // -07:00
print(datetime.format('ZZZ', 'PST8PDT')); // PST8PDT
// single quotes for text
print(datetime.format("YY 'yada' MM")); // 75 yada 07
// '' for a single quote
print(datetime.format("YY ''MM'' dd")); // 75 '07' 23
Python 설정
Python API 및 geemap
를 사용한 대화형 개발에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
import ee
import geemap.core as geemap
Colab (Python)
# Various examples of ee.Date.format with Joda-Time formatting and time zones.
date = ee.Date('2020-08-18') # Defaults to UTC
display(date) # Date (2020-08-18 00:00:00)
# List of time zones:
# https://www.joda.org/joda-time/timezones.html
display(date.format(None, 'GMT')) # 2020-08-18T00:00:00
display(date.format(None, 'Etc/GMT')) # 2020-08-18T00:00:00
display(date.format(None, 'Etc/GMT+0')) # 2020-08-18T00:00:00
display(date.format(None, 'Zulu')) # 2020-08-18T00:00:00
display(date.format(None, 'UTC')) # 2020-08-18T00:00:00
display(date.format(None, 'America/Los_Angeles')) # 2020-08-17T17:00:00
display(date.format(None, 'US/Pacific')) # 2020-08-17T17:00:00
display(date.format(None, 'Etc/GMT+8')) # 2020-08-17T17:00:00
display(date.format(None, 'PST8PDT')) # 2020-08-17T17:00:00
display(date.format(None, 'Australia/Tasmania')) # 2020-08-18T10:00:00
display(date.format(None, 'Etc/GMT-10')) # 2020-08-18T10:00:00
# Reference for Joda-Time format characters:
# http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
datetime = ee.Date('1975-07-23T21:13:59') # Defaults to UTC
display(datetime) # Date (1972-07-25 21:13:59)
# year of era and era
display(datetime.format('YYYY GG')) # 1975 AD
# century and year
display(datetime.format('CC YY')) # 19 75
# weekyear and week of weekyear
display(datetime.format('xxxx ww')) # 1975 30
# year and day of year
display(datetime.format('yy DDD')) # 75 204
# month of year and day of month
display(datetime.format('MM dd')) # 07 23
# day of week number and day of week text
display(datetime.format('e E')) # 3 Wed
display(datetime.format('e EEEEEEEE')) # 3 Wednesday
# half of day, hour of halfday, and clockhour of halfday
display(datetime.format('a K h')) # PM 9 9
display(datetime.format('a KK hh')) # PM 09 09
# hour of day, clockhour of day, minute, second, fraction of second
display(datetime.format('H k m s S')) # 21 21 13 59 0
display(datetime.format('HH kk mm ss SS')) # 21 21 13 59 00
# time zone
display(datetime.format('z')) # UTC
display(datetime.format('zzzz')) # Coordinated Universal Time
display(datetime.format('z', 'PST8PDT')) # PDT
display(datetime.format('zzzz', 'PST8PDT')) # Pacific Daylight Time
# time zone offset/id
display(datetime.format('Z')) # +0000
display(datetime.format('ZZ')) # +00:00
display(datetime.format('ZZZ')) # UTC
display(datetime.format('Z', 'PST8PDT')) # -0700
display(datetime.format('ZZ', 'PST8PDT')) # -07:00
display(datetime.format('ZZZ', 'PST8PDT')) # PST8PDT
# single quotes for text
display(datetime.format("YY 'yada' MM")) # 75 yada 07
# '' for a single quote
display(datetime.format("YY ''MM'' dd")) # 75 '07' 23
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eee.Date.format()\u003c/code\u003e converts an Earth Engine \u003ccode\u003eDate\u003c/code\u003e object to a formatted string representation.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eformat\u003c/code\u003e argument uses Joda-Time formatting patterns for customization.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003etimeZone\u003c/code\u003e argument, if provided, adjusts the output to the specified time zone; defaults to UTC.\u003c/p\u003e\n"],["\u003cp\u003eIf \u003ccode\u003eformat\u003c/code\u003e is omitted, the ISO standard date formatting is used.\u003c/p\u003e\n"],["\u003cp\u003eJoda-Time formatting patterns provide flexible options to display various date and time components, including year, month, day, hour, minute, second, time zone, and more.\u003c/p\u003e\n"]]],["The `Date.format()` method converts a date to a string. It accepts a `format` string based on Joda-Time patterns and an optional `timeZone` string; if these arguments are omitted, the function will use default ISO formatting and UTC timezone. The method takes a date as input, and outputs a string representing the date, with specific formatting and time zone adjustments. The document also shows how to apply the formatting patterns.\n"],null,["# ee.Date.format\n\nConvert a date to string.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------|---------|\n| Date.format`(`*format* `, `*timeZone*`)` | String |\n\n| Argument | Type | Details |\n|--------------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `date` | Date | |\n| `format` | String, default: null | A pattern, as described at http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html; if omitted will use ISO standard date formatting. |\n| `timeZone` | String, default: null | The time zone (e.g., 'America/Los_Angeles'); defaults to UTC. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Various examples of ee.Date.format with Joda-Time formatting and time zones.\n\nvar date = ee.Date('2020-08-18'); // Defaults to UTC\nprint(date); // Date (2020-08-18 00:00:00)\n\n// List of time zones:\n// https://www.joda.org/joda-time/timezones.html\n\nprint(date.format(null, 'GMT')); // 2020-08-18T00:00:00\nprint(date.format(null, 'Etc/GMT')); // 2020-08-18T00:00:00\nprint(date.format(null, 'Etc/GMT+0')); // 2020-08-18T00:00:00\nprint(date.format(null, 'Zulu')); // 2020-08-18T00:00:00\nprint(date.format(null, 'UTC')); // 2020-08-18T00:00:00\n\nprint(date.format(null, 'America/Los_Angeles')); // 2020-08-17T17:00:00\nprint(date.format(null, 'US/Pacific')); // 2020-08-17T17:00:00\nprint(date.format(null, 'Etc/GMT+8')); // 2020-08-17T17:00:00\nprint(date.format(null, 'PST8PDT')); // 2020-08-17T17:00:00\n\nprint(date.format(null, 'Australia/Tasmania')); // 2020-08-18T10:00:00\nprint(date.format(null, 'Etc/GMT-10')); // 2020-08-18T10:00:00\n\n// Reference for Joda-Time format characters:\n// https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html\n\nvar datetime = ee.Date('1975-07-23T21:13:59'); // Defaults to UTC\nprint(datetime); // Date (1972-07-25 21:13:59)\n\n// year of era and era\nprint(datetime.format('YYYY GG')); // 1975 AD\n// century and year\nprint(datetime.format('CC YY')); // 19 75\n// weekyear and week of weekyear\nprint(datetime.format('xxxx ww')); // 1975 30\n\n// year and day of year\nprint(datetime.format('yy DDD')); // 75 204\n// month of year and day of month\nprint(datetime.format('MM dd')); // 07 23\n\n// day of week number and day of week text\nprint(datetime.format('e E')); // 3 Wed\nprint(datetime.format('e EEEEEEEE')); // 3 Wednesday\n\n// half of day, hour of halfday, and clockhour of halfday\nprint(datetime.format('a K h')); // PM 9 9\nprint(datetime.format('a KK hh')); // PM 09 09\n\n// hour of day, clockhour of day, minute, second, fraction of second\nprint(datetime.format('H k m s S')); // 21 21 13 59 0\nprint(datetime.format('HH kk mm ss SS')); // 21 21 13 59 00\n\n// time zone\nprint(datetime.format('z')); // UTC\nprint(datetime.format('zzzz')); // Coordinated Universal Time\nprint(datetime.format('z', 'PST8PDT')); // PDT\nprint(datetime.format('zzzz', 'PST8PDT')); // Pacific Daylight Time\n\n// time zone offset/id\nprint(datetime.format('Z')); // +0000\nprint(datetime.format('ZZ')); // +00:00\nprint(datetime.format('ZZZ')); // UTC\nprint(datetime.format('Z', 'PST8PDT')); // -0700\nprint(datetime.format('ZZ', 'PST8PDT')); // -07:00\nprint(datetime.format('ZZZ', 'PST8PDT')); // PST8PDT\n\n// single quotes for text\nprint(datetime.format(\"YY 'yada' MM\")); // 75 yada 07\n// '' for a single quote\nprint(datetime.format(\"YY ''MM'' dd\")); // 75 '07' 23\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Various examples of ee.Date.format with Joda-Time formatting and time zones.\n\ndate = ee.Date('2020-08-18') # Defaults to UTC\ndisplay(date) # Date (2020-08-18 00:00:00)\n\n# List of time zones:\n# https://www.joda.org/joda-time/timezones.html\n\ndisplay(date.format(None, 'GMT')) # 2020-08-18T00:00:00\ndisplay(date.format(None, 'Etc/GMT')) # 2020-08-18T00:00:00\ndisplay(date.format(None, 'Etc/GMT+0')) # 2020-08-18T00:00:00\ndisplay(date.format(None, 'Zulu')) # 2020-08-18T00:00:00\ndisplay(date.format(None, 'UTC')) # 2020-08-18T00:00:00\n\ndisplay(date.format(None, 'America/Los_Angeles')) # 2020-08-17T17:00:00\ndisplay(date.format(None, 'US/Pacific')) # 2020-08-17T17:00:00\ndisplay(date.format(None, 'Etc/GMT+8')) # 2020-08-17T17:00:00\ndisplay(date.format(None, 'PST8PDT')) # 2020-08-17T17:00:00\n\ndisplay(date.format(None, 'Australia/Tasmania')) # 2020-08-18T10:00:00\ndisplay(date.format(None, 'Etc/GMT-10')) # 2020-08-18T10:00:00\n\n# Reference for Joda-Time format characters:\n# http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html\n\ndatetime = ee.Date('1975-07-23T21:13:59') # Defaults to UTC\ndisplay(datetime) # Date (1972-07-25 21:13:59)\n\n# year of era and era\ndisplay(datetime.format('YYYY GG')) # 1975 AD\n# century and year\ndisplay(datetime.format('CC YY')) # 19 75\n# weekyear and week of weekyear\ndisplay(datetime.format('xxxx ww')) # 1975 30\n\n# year and day of year\ndisplay(datetime.format('yy DDD')) # 75 204\n# month of year and day of month\ndisplay(datetime.format('MM dd')) # 07 23\n\n# day of week number and day of week text\ndisplay(datetime.format('e E')) # 3 Wed\ndisplay(datetime.format('e EEEEEEEE')) # 3 Wednesday\n\n# half of day, hour of halfday, and clockhour of halfday\ndisplay(datetime.format('a K h')) # PM 9 9\ndisplay(datetime.format('a KK hh')) # PM 09 09\n\n# hour of day, clockhour of day, minute, second, fraction of second\ndisplay(datetime.format('H k m s S')) # 21 21 13 59 0\ndisplay(datetime.format('HH kk mm ss SS')) # 21 21 13 59 00\n\n# time zone\ndisplay(datetime.format('z')) # UTC\ndisplay(datetime.format('zzzz')) # Coordinated Universal Time\ndisplay(datetime.format('z', 'PST8PDT')) # PDT\ndisplay(datetime.format('zzzz', 'PST8PDT')) # Pacific Daylight Time\n\n# time zone offset/id\ndisplay(datetime.format('Z')) # +0000\ndisplay(datetime.format('ZZ')) # +00:00\ndisplay(datetime.format('ZZZ')) # UTC\ndisplay(datetime.format('Z', 'PST8PDT')) # -0700\ndisplay(datetime.format('ZZ', 'PST8PDT')) # -07:00\ndisplay(datetime.format('ZZZ', 'PST8PDT')) # PST8PDT\n\n# single quotes for text\ndisplay(datetime.format(\"YY 'yada' MM\")) # 75 yada 07\n# '' for a single quote\ndisplay(datetime.format(\"YY ''MM'' dd\")) # 75 '07' 23\n```"]]