컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
timestamp.get_date
timestamp.get_date(unix_seconds [, time_zone])
설명
이 함수는 타임스탬프가 있는 날짜를 나타내는 YYYY-MM-DD
형식의 문자열을 반환합니다.
unix_seconds
는 유닉스 시간을 기준으로 지난 초 수(예: $e.metadata.event_timestamp.seconds
)를 나타내는 정수이거나 해당 값을 포함하는 자리표시자입니다.
time_zone
은 선택사항이며 time_zone을 나타내는 문자열입니다. 생략한 경우 기본값은 'GMT'입니다. 문자열 리터럴을 사용하여 시간대를 지정할 수 있습니다. 옵션은 다음과 같습니다.
- TZ 데이터베이스 이름, 예: 'America/Los_Angeles'. 자세한 내용은 이 페이지의 'TZ 데이터베이스 이름' 열을 참조하세요.
- UTC의 시간대 오프셋은
(+|-)H[H][:M[M]]
형식으로 지정됩니다(예: '-08:00').
다음은 시간 추출 함수에 두 번째 인수로 전달할 수 있는 다른 올바른 time_zone 지정자의 예시입니다.
"America/Los_Angeles", or "-08:00". ("PST" is not supported)
"America/New_York", or "-05:00". ("EST" is not supported)
"Europe/London"
"UTC"
"GMT"
매개변수 데이터 유형
INT
, STRING
반환 유형
STRING
코드 샘플
예 1
이 예시에서는 time_zone
인수가 생략되었으므로 기본값은 'GMT'입니다.
$ts = $e.metadata.collected_timestamp.seconds
timestamp.get_date($ts) = "2024-02-19"
예 2
이 예시에서는 문자열 리터럴을 사용하여 time_zone
을 정의합니다.
$ts = $e.metadata.collected_timestamp.seconds
timestamp.get_date($ts, "America/Los_Angeles") = "2024-02-20"
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-29(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-29(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003etimestamp.get_date\u003c/code\u003e function extracts the date in \u003ccode\u003eYYYY-MM-DD\u003c/code\u003e format from a Unix timestamp.\u003c/p\u003e\n"],["\u003cp\u003eIt requires an integer representing the Unix timestamp in seconds as input, and can also optionally take a string specifying the time zone.\u003c/p\u003e\n"],["\u003cp\u003eIf the time zone is not specified, the function defaults to "GMT".\u003c/p\u003e\n"],["\u003cp\u003eValid time zone formats include TZ database names like "America/Los_Angeles" or offsets like "-08:00", but abbreviations like "PST" or "EST" are not supported.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a string representing the date in \u003ccode\u003eYYYY-MM-DD\u003c/code\u003e format.\u003c/p\u003e\n"]]],[],null,["### timestamp.get_date\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n timestamp.get_date(unix_seconds [, time_zone])\n\n#### Description\n\nThis function returns a string in the format `YYYY-MM-DD`, representing the day a timestamp is in.\n\n- `unix_seconds` is an integer representing the number of seconds past Unix epoch, such as `$e.metadata.event_timestamp.seconds`, or a placeholder containing that value.\n- `time_zone` is optional and is a string representing a time_zone. If omitted, the default is \"GMT\". You can specify time zones using string literals. The options are:\n - The TZ database name, for example \"America/Los_Angeles\". For more information, see the [\"TZ Database Name\" column from this page](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)\n - The time zone offset from UTC, in the format`(+|-)H[H][:M[M]]`, for example: \"-08:00\".\n\nHere are examples of valid time_zone specifiers, which you can pass as the second argument to time extraction functions: \n\n \"America/Los_Angeles\", or \"-08:00\". (\"PST\" is not supported)\n \"America/New_York\", or \"-05:00\". (\"EST\" is not supported)\n \"Europe/London\"\n \"UTC\"\n \"GMT\"\n\n#### Param data types\n\n`INT`, `STRING`\n\n#### Return type\n\n`STRING`\n\n#### Code samples\n\n##### Example 1\n\nIn this example, the `time_zone` argument is omitted, so it defaults to \"GMT\". \n\n $ts = $e.metadata.collected_timestamp.seconds\n\n timestamp.get_date($ts) = \"2024-02-19\"\n\n##### Example 2\n\nThis example uses a string literal to define the `time_zone`. \n\n $ts = $e.metadata.collected_timestamp.seconds\n\n timestamp.get_date($ts, \"America/Los_Angeles\") = \"2024-02-20\""]]