> For the complete documentation index, see [llms.txt](https://docs-kr.zep.us/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-kr.zep.us/zep-script-api/zepscriptapi/utilityclass/time.md).

# Time

### **소개**

ZEP 서버의 시간을 조회하는 등 시간 데이터를 가져오는 함수를 모아놓은 클래스입니다.

### Methods

<table><thead><tr><th width="174">이름</th><th>설명</th></tr></thead><tbody><tr><td>getTime</td><td>ZEP 서버의 현재 시간을 milliseconds 단위의  값으로 리턴합니다.</td></tr><tr><td>getUtcTime</td><td>현재 UTC 시간을 milliseconds 단위의 값으로  리턴합니다.</td></tr><tr><td>getTimeInterval</td><td>파라미터로 입력한 두 시간의 차이를 계산해 값을 리턴합니다.</td></tr></tbody></table>

### getTime

{% hint style="info" %}
Time.getTime()
{% endhint %}

ZEP 서버의 현재 시간을 milliseconds 단위의  값으로 리턴합니다.

#### 예제

```
// Q를 누르면 동작하는 함수
App.addOnKeyDown(KeyCodeType.q, (player)=>{
    player.sendMessage(`Server Time: ${Time.getTime()}`);
});
```

###

### getUtcTime

{% hint style="info" %}
Time.getUtcTime()
{% endhint %}

현재 UTC 시간을 milliseconds 단위의 값으로  리턴합니다.

#### 예제

```
// Q를 누르면 동작하는 함수
App.addOnKeyDown(KeyCodeType.q, (player)=>{
    player.sendMessage(`UTC Time: ${Time.getUtcTime()}`);
});
```

### getTimeInterval

{% hint style="info" %}
Time.getTimeInterval(timeA: number, timeB: number, returnType: DateType)
{% endhint %}

`timeB - timeA`를 계산하고, 그 결과를 지정한 `returnType`으로 반환합니다.

**파라미터**

<table><thead><tr><th width="156.33333333333331">이름</th><th width="159">타입</th><th>설명</th></tr></thead><tbody><tr><td>timeA, timeB</td><td>Number</td><td>차이를 계산할 시간 (milliseconds)</td></tr><tr><td>returnType</td><td>DateType</td><td><p>DateType.MILLISECONDS ( ms 단위 )</p><p>DateType.SECONDS (초 단위 )</p><p>DateType.MINUTES ( 분 단위 )</p><p>DateType.HOURS ( 시간 단위 )</p><p>DateType.DAYS ( 일 단위 )</p></td></tr></tbody></table>

#### 예제

```
// Q를 누르면 동작하는 함수
App.addOnKeyDown(KeyCodeType.q, (player)=>{
    const currentTime = Time.getTime();
    const utcTime = Time.getUtcTime();
    player.sendMessage(`timeInterval: ${Time.getTimeInterval(currentTime, utcTime, DateType.MILLISECONDS)}`);
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs-kr.zep.us/zep-script-api/zepscriptapi/utilityclass/time.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
