# 날짜/시간 함수

{% hint style="info" %}
PantherFlow는 Panther 버전 1.110부터 오픈 베타로 제공되며, 모든 고객이 사용할 수 있습니다. 버그 보고 및 기능 요청이 있으면 Panther 지원팀에 공유해 주세요.
{% endhint %}

## `time.add()`

`time.add(timestamp: timestamp, value: int, unit: string) -> timestamp`

반환 `타임스탬프` 다음을 결합하여 생성된 시간 범위에 더함 `값` 과 시간 `단위`을 제공하세요 `"hour"`. `값` 열이 될 수 있으며, 이는 시간 범위 상수를 직접 더하는 것보다 더 표현력이 풍부한 타임스탬프 산술을 가능하게 합니다. 뺄셈은 음수 `값`. `단위` 다음이 될 수 있습니다:

* `년`, `y`
* `월`
* `일`, `d`
* `시`, `h`
* `분`, `m`
* `초`, `s`

더 많은 값이 허용될 수 있지만, 향후 릴리스에서 지원이 보장되지는 않습니다.

**예시:**

```kusto
let timebins =
range N from 1 to 10 step 1
| project t1=time.add(time.now(), N, 'day')
```

## `time.ago()`

`time.ago(span: timespan) -> timestamp`

다음인 타임스탬프를 반환합니다 `span` 시간 전의.

**예시:**

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.ago(1d)
```

## `time.diff()`

`time.diff(unit: string, timestamp1: timestamp, timestamp2: timestamp) -> int`

요청된 날짜 또는 시간 단위를 기준으로 두 타임스탬프 간의 차이를 계산합니다. 이 함수는 timestamp1을 timestamp2에서 뺀 결과(즉, timestamp2 - timestamp1)를 반환합니다. `단위` 다음이 될 수 있습니다:

* `년`, `y`
* `월`
* `일`, `d`
* `시`, `h`
* `분`, `m`
* `초`, `s`

더 많은 값이 허용될 수 있지만, 향후 릴리스에서 지원이 보장되지는 않습니다.

**예시:**

```kusto
panther_logs.public.aws_alb
| extend hoursToParse=time.diff('h', p_event_time, p_parse_time)
| extend minutesToParse=time.diff('m', p_event_time, p_parse_time)
| project hoursToParse, minutesToParse
```

## `time.now()`

`time.now() -> timestamp`

현재 타임스탬프를 반환합니다.

**예시:**

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.now() - 1d
```

## `time.parse_timespan()`

`time.parse_timespan(str: string) -> timespan`

기간 문자열의 시간 범위 표현을 반환합니다.

**예시:**

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.now() - time.parse_timespan('24h')
```

## `time.parse_timestamp()`

`time.parse_timestamp(str: string) -> timestamp`

타임스탬프 문자열의 타임스탬프 표현을 반환합니다.

**예시:**

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.parse_timestamp('2023-01-01T00:00:00')
```

## `time.slice()`

`time.slice(time: timestamp, slice_length: int, slice_unit: string) -> timestamp`

다음에 해당하는 타임스탬프를 반환합니다 `time` 가 포함되는 위치를, 다음 단위의 조각으로 나누어 기준 삼아 반환합니다 `slice_unit` 및 `slice_length`. 예를 들어 `slice_length` 이 1이고 `slice_unit` 가 "hour"이면, 시간은 속한 시간 단위로 잘립니다. 조각은 1970년 1월 1일 자정 기준으로 계산됩니다. `slice_unit` 다음이 될 수 있습니다:

* `년`, `y`
* `월`
* `일`, `d`
* `시`, `h`
* `분`, `m`
* `초`, `s`

더 많은 값이 허용될 수 있지만, 향후 릴리스에서 지원이 보장되지는 않습니다.

**예시:**

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.ago(1d)
| summarize count=agg.count() by bucket=time.slice(p_event_time, 10, 'm')
| sort bucket asc
| visualize
```

## `time.trunc()`

`time.trunc(unit: string, timestamp: timestamp) -> timestamp`

지정된 단위로 잘린 타임스탬프를 반환합니다. `단위` 다음이 될 수 있습니다:

* `년`, `y`
* `월`
* `일`, `d`
* `시`, `h`
* `분`, `m`
* `초`, `s`

더 많은 값이 허용될 수 있지만, 향후 릴리스에서 지원이 보장되지는 않습니다.

**예시:**

```kusto
panther_logs.public.aws_alb
| where p_event_time > time.ago(1d)
| extend minuteEventHappened=time.trunc('m', p_event_time)
| summarize eventsPerMinute=agg.count() by minuteEventHappened
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.panther.com/ko/pantherflow/functions/date-time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
