format
-
코드 /** * 날짜를 입력받은 형식으로 변환해주는 함수 * @params {string} format 형식 * @params {string, object} date 날짜 * @returns {string} date를 format 형식으로 변환 */ function dateFormat(foramt, date) { if (date == undefined) { return " "; } if (typeof date != 'object') { date = new Date(date); } var weekKorName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]; var weekKorShortName = ["일", "월", "화", "수", "목", "..
js - js로 php의 date_format 기능 따라하기코드 /** * 날짜를 입력받은 형식으로 변환해주는 함수 * @params {string} format 형식 * @params {string, object} date 날짜 * @returns {string} date를 format 형식으로 변환 */ function dateFormat(foramt, date) { if (date == undefined) { return " "; } if (typeof date != 'object') { date = new Date(date); } var weekKorName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]; var weekKorShortName = ["일", "월", "화", "수", "목", "..
2022.09.25 -
// YYYY-mm-dd 형식 출력 년월일 = 시간.substring(0, 10); // date type 변수 문자열 변환 문자열 = 시간.toISOString();
js - 시간 년월일 출력, date type 변수 문자열 변환// YYYY-mm-dd 형식 출력 년월일 = 시간.substring(0, 10); // date type 변수 문자열 변환 문자열 = 시간.toISOString();
2022.08.18 -
// 숫자 3자리 콤마 $숫자 = number_format($숫자);
php - 숫자 3자리마다 콤마// 숫자 3자리 콤마 $숫자 = number_format($숫자);
2022.08.18 -
// 시간 포맷 $시간 = date("Y-m-d H:i:s", strtotime($시간));
php - 시간 포맷// 시간 포맷 $시간 = date("Y-m-d H:i:s", strtotime($시간));
2022.08.18 -
// 핸드폰 번호 형식 010-0000-0000 preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $핸드폰번호);
php - 핸드폰 형식 포맷// 핸드폰 번호 형식 010-0000-0000 preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $핸드폰번호);
2022.08.18 -
올림Math.ceil()double num = 123.4567891011;double test = Math.ceil(num); // 124// Math.cail()는 소수점 첫째자리를 기준으로 올림하는 메소드이다.반올림Math.round()double num = 123.4567891011;double test = Math.round(num); // 123// Math.round()는 소수점 첫째자리를 기준으로 반올림하는 메소드이다.double result1 = Math.round(num * 100) / 100.0; // 123.46// 둘째자리까지 나타내려면 100을 곱해주고 후에 100.0으로 나눠준다. 100으로 나누면 정수형으로 변환되기 때문에 100.0으로 나눠야 한다.버림String.fomat(..
Java - 소수점 올림, 반올림, 버림올림Math.ceil()double num = 123.4567891011;double test = Math.ceil(num); // 124// Math.cail()는 소수점 첫째자리를 기준으로 올림하는 메소드이다.반올림Math.round()double num = 123.4567891011;double test = Math.round(num); // 123// Math.round()는 소수점 첫째자리를 기준으로 반올림하는 메소드이다.double result1 = Math.round(num * 100) / 100.0; // 123.46// 둘째자리까지 나타내려면 100을 곱해주고 후에 100.0으로 나눠준다. 100으로 나누면 정수형으로 변환되기 때문에 100.0으로 나눠야 한다.버림String.fomat(..
2022.02.24