# 데이터 형 변환

## 개요

데이터 형태를 변환하여 반환해요.

ex) "5" -> 5, 5 -> "5", "2022-12-24'T'12:14" -> Date("2022-12-24'T'12:14")

```
{
	"name": "cast", //고정(필수)
	"method": "type",//고정 (필수)
	"details": {
		"base": "tmpDocument.testString",//모든타입 (필수)
		"type": "dateTime", //String(필수)
		"format": "yyyy-MM-dd'T'HH:mm" //String(선택)
	}
}
```

## 필드

* details
  * base: 형 변환 대상이에요.&#x20;
  * type: 형 변환 타입이에요.&#x20;
  * format: 형 변환 대상의 date format 이에요.&#x20;
    * "type"이 "toDate"일 때는 필수 입력이에요.&#x20;

## 옵션

* details
  * type
    * ObjectId: 형 변환 대상이 String 일 경우 해당 String으로 ObjectId를 생성해요.&#x20;
    * toString: 형 변환 대상을 String으로 변환해요.
    * int: 형 변환 대상을 Integer으로 변환해요.
    * double: 형 변환 대상을 Double으로 변환해요.
    * toDate: 형 변환 대상을 Date으로 변환해요.
      * String: format 형에 맞춰서 String을 Date로 변환해요.&#x20;
      * Number: Long형을 Millisecond로 환산하여 Date로 변환해요.&#x20;

## 예시

```
{
	"name": "cast",
	"method": "type",
	"details": {
		"base": "3",
		"type": "int"
	}
}
->

3
```

## 예시(toDate)

```
{
	"name": "cast",
	"method": "type",
	"details": {
		"base": "2022-03-02",
		"type": "toDate",
		"format" : "yyyy-MM-dd"
	}
}
->

Date("2022-03-02")
```

## 사용 예시

```
....
{
	"@setValue": {
		"nextQuestion": {
			"name": "cast",
			"method": "type",
			"details": {
				"base": "tmpDocument.nextQuestion.priority",
				"type": "toString"
			}
		}
	}
}
...
```

2023.10.18 Bobby


---

# 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.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic/util/eventflowutil.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.
