반응형
Id 데이터 형식 변환
아이디 → 문자열
String convertedStr = String.valurOf(id);
문자열 → 아이디
Id convertedId = Id.valueOf(str);
Integer 데이터 형식 변환
정수 → 문자열
String convertedStr = String.valurOf(int);
문자열 → 정수
Integer convertedInt = Integer.valueOf(str)
정수 → 10진수
Decimal convertedDec = decimal.valueOf(int);
10진수 → 정수
Integer convertedInt = Integer.valueOf(decimal)
Decimal 데이터 형식 변환
10진수 → 문자열
String convertedStr = String.valurOf(decimal);
문자열 → 10진수
Decimal convertedDec = decimal.valueOf(str);
10진수 → 정수
Integer convertedInt = Integer.valueOf(decimal)
정수 → 10진수
Decimal convertedDec = decimal.valueOf(int);
Date 데이터 형식 변환
날짜 → 문자열
String convertedStr = String.valurOf(date);
문자열 → 날짜
Date convertedDate = Date.valueOf(str);
날짜 → 날짜 시간
Datetime dt = datetime.newInstance(date.year(), date.month(),date.day());
날짜시간 → 날짜
Date date = date.newinstance(dt.year(), dt.month(), dt.day());
DateTime 데이터 형식 변환
날짜 시간 → 문자열
String convertedStr = String.valurOf(dt);
문자열 → 날짜/시간
Datetime convertedDt = DateTime.valueOf(str);
날짜시간 → 날짜
Date date = date.newinstance(dt.year(), dt.month(), dt.day());
날짜 → 날짜 시간
Datetime dt = datetime.newInstance(date.year(), date.month(),date.day());
반응형
'개발자정보' 카테고리의 다른 글
FOR LOOP 내에서 SOQL을 피하는 방법 (0) | 2022.01.17 |
---|---|
(Salesforce)특정 항목의 값이 입력되어 있는 레코드의 수나 비율을 표시하는 리포트 작성 방법 (0) | 2022.01.17 |
Gmail이 이메일을 Salesforce에 동기화하는 방법 (0) | 2022.01.17 |
수식 등으로 레코드 URL, 조직 URL을 동적으로 검색하는 방법 (0) | 2022.01.17 |
[비기능]Salesforce를 사용하는 방법 Tips: 모르면 손해! Salesforce에서 보고할 때 유용한 '버킷' 기능 (0) | 2022.01.17 |