• Y
  • List All
  • Feedback
    • This Project
    • This Group
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
2025_PROJECT / mjgo_git star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
mjgo_gitsrcmainjavaitncomcmmutilDateUtils.java
Download as .zip file
File name
Commit message
Commit date
DATABASE
first commit
2025-12-15
src/main
토스페이 캐시 적립/가상계좌 입금 콜백 구현 및 라이브 키 적용
06-26
.codetogether.ignore
first commit
2025-12-15
.gitignore
first commit
2025-12-15
pom.xml
build name 수정
03-17
File name
Commit message
Commit date
java
토스페이 캐시 적립/가상계좌 입금 콜백 구현 및 라이브 키 적용
06-26
resources
토스페이 캐시 적립/가상계좌 입금 콜백 구현 및 라이브 키 적용
06-26
webapp
토스페이 캐시 적립/가상계좌 입금 콜백 구현 및 라이브 키 적용
06-26
File name
Commit message
Commit date
egovframework
first commit
2025-12-15
itn
토스페이 캐시 적립/가상계좌 입금 콜백 구현 및 라이브 키 적용
06-26
File name
Commit message
Commit date
com
5733 메인배너 이미지관리 좌표 추가
04-24
let
토스페이 캐시 적립/가상계좌 입금 콜백 구현 및 라이브 키 적용
06-26
web
first commit
2025-12-15
File name
Commit message
Commit date
api/web
first commit
2025-12-15
cmm
first commit
2025-12-15
sym/log/ulg
first commit
2025-12-15
usr/search/web
first commit
2025-12-15
uss
5733 메인배너 이미지관리 좌표 추가
04-24
utl
first commit
2025-12-15
File name
Commit message
Commit date
aspect
first commit
2025-12-15
captcha
first commit
2025-12-15
filter
first commit
2025-12-15
interceptor
first commit
2025-12-15
service
first commit
2025-12-15
session
first commit
2025-12-15
taglibs
first commit
2025-12-15
util
first commit
2025-12-15
web
first commit
2025-12-15
AltibaseClobStringTypeHandler.java
first commit
2025-12-15
ComDefaultCodeVO.java
first commit
2025-12-15
ComDefaultVO.java
first commit
2025-12-15
EgovComCrossSiteHndlr.java
first commit
2025-12-15
EgovComExcepHndlr.java
first commit
2025-12-15
EgovComOthersExcepHndlr.java
first commit
2025-12-15
EgovComTraceHandler.java
first commit
2025-12-15
EgovMessageSource.java
first commit
2025-12-15
EgovMultiPartEmail.java
first commit
2025-12-15
EgovWebUtil.java
first commit
2025-12-15
ImagePaginationRenderer.java
first commit
2025-12-15
ImagePaginationRendererWeb.java
first commit
2025-12-15
JsonResult.java
first commit
2025-12-15
LoginVO.java
first commit
2025-12-15
MjonFTSendVO.java
first commit
2025-12-15
MjonMsgSendVO.java
first commit
2025-12-15
OptimalMsgResultDTO.java
first commit
2025-12-15
ReadVO.java
first commit
2025-12-15
RestResponse.java
first commit
2025-12-15
SessionVO.java
first commit
2025-12-15
UserVO.java
first commit
2025-12-15
File name
Commit message
Commit date
ContextUtil.java
first commit
2025-12-15
Criteria.java
first commit
2025-12-15
DateUtils.java
first commit
2025-12-15
EgovBasicLogger.java
first commit
2025-12-15
EgovDoubleSubmitHelper.java
first commit
2025-12-15
EgovResourceCloseHelper.java
first commit
2025-12-15
ExcelDownloadUtil.java
first commit
2025-12-15
ExcelUploadUtil.java
first commit
2025-12-15
FaxUtil.java
first commit
2025-12-15
FileUtil.java
first commit
2025-12-15
IpUtil.java
first commit
2025-12-15
MJUtil.java
first commit
2025-12-15
MsgSendUtils.java
first commit
2025-12-15
Order.java
first commit
2025-12-15
OsProcessCheckUtil.java
first commit
2025-12-15
PayUtils.java
first commit
2025-12-15
PdfUtil.java
first commit
2025-12-15
RedirectUrlMaker.java
first commit
2025-12-15
SlackMessageFormatUtil.java
first commit
2025-12-15
StringUtil.java
first commit
2025-12-15
StringUtil2.java
first commit
2025-12-15
TokenUtil.java
first commit
2025-12-15
WebUtil.java
first commit
2025-12-15
XssFilterUtil.java
first commit
2025-12-15
hehihoho3@gmail.com 2025-12-15 7152e15 first commit UNIX
Raw Open in browser Change history
package itn.com.cmm.util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.Date; /** * * @author : 이호영 * @fileName : DateUtil.java * @date : 2023.04.06 * @description : Date 다루는 Util * =========================================================== * DATE AUTHOR NOTE * ----------------------------------------------------------- * * 2023.04.06 이호영 최초 생성 * * * */ public final class DateUtils { // 날짜를 포맷하는 기본 포맷터 정의 private static final DateTimeFormatter SLUSH_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd"); /** * @methodName : getTodayYearAndMonthAndFirstDay * @author : 이호영 * @date : 2023.04.06 * @description : 해당 년월일 구하기 : 일은 1일 * @return ex) 2023/04/01 */ public static String getTodayYearAndMonthAndFirstDay() { LocalDate currentDate = LocalDate.now(); return LocalDate.of(currentDate.getYear(), currentDate.getMonthValue(), 1) .format( DateTimeFormatter.ofPattern("yyyy/MM/dd")); } /** * @methodName : getTodayYearAndMonthAndLastDay * @author : 이호영 * @date : 2023.04.06 * @description : 해당 년월일 구하기 : 일은 마지막일 * @return ex) 2023/04/30 */ public static String getTodayYearAndMonthAndLastDay() { LocalDate currentDate = LocalDate.now(); return LocalDate.of(currentDate.getYear(), currentDate.getMonthValue(), currentDate.lengthOfMonth()) .format( DateTimeFormatter.ofPattern("yyyy/MM/dd")); } /** * @methodName : getNowYearToString * @author : 이호영 * @date : 2023.04.07 * @description : 현재 연도 * @return : String */ public static String getNowYearToString() { return Integer.toString(LocalDate.now().getYear()); } /** * @methodName : getNowMonthToString * @author : 이호영 * @date : 2023.04.07 * @description : 현재 월 * @return : String */ public static String getNowMonthToString() { LocalDate currentDate = LocalDate.now(); return Integer.toString(currentDate.getMonthValue()); } /** * @methodName : getNowDayToString * @author : 이호영 * @date : 2023.04.07 * @description : 현재 일 * @return : String */ public static String getNowDayToString() { LocalDate currentDate = LocalDate.now(); return Integer.toString(currentDate.getDayOfMonth()); } /** * @methodName : getNowDayToString * @author : 이호영 * @date : 2023.08.08 * @description : yyyy-MM-dd HH:mm:ss.S 형식을 yyyy-MM-dd HH:mm 로 변환 * @return * @throws ParseException */ public static String getChangFormatS(String str) throws ParseException { SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); // 원본 형식 Date date = inputFormat.parse(str); // 문자열을 날짜 객체로 변환 SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // 원하는 출력 형식 String formattedDate = outputFormat.format(date); // 날짜 객체를 원하는 형식의 문자열로 변환 return formattedDate; // 출력: 2023-08-07 09:36 } // 현재 날짜를 기본 포맷으로 반환 public static String getCurrentDate() { return getCurrentDate(SLUSH_FORMATTER); } // 현재 날짜를 지정된 포맷으로 반환 public static String getCurrentDate(DateTimeFormatter formatter) { LocalDate today = LocalDate.now(); return today.format(formatter); } // 현재 날짜에서 특정 일수 전 날짜를 기본 포맷으로 반환 public static String getDateMonthsAgo(int months) { return getDateMonthsAgo(months, SLUSH_FORMATTER); } // 현재 날짜에서 특정 일수 전 날짜를 지정된 포맷으로 반환 public static String getDateMonthsAgo(int months, DateTimeFormatter formatter) { LocalDate today = LocalDate.now(); // System.out.println("months : "+ months); // System.out.println("today.minusMonths(months) : "+ today.minusMonths(months).format(formatter)); LocalDate monthsAgo = today.minusMonths(months).plusDays(1); // System.out.println("monthsAgo : " + monthsAgo); // System.out.println("monthsAgo.format(formatter) : " + monthsAgo.format(formatter)); return monthsAgo.format(formatter); } /** * @methodName : dateChkAndValueChk * @author : 이호영 * @date : 2024.07.05 * @description : 검색 날짜 검증 및 일수 체크 * @param searchStartDate * @param searchEndDate * @param dateVal * @return */ public static boolean dateChkAndValueChk(String searchStartDate, String searchEndDate, int months) { boolean isValid = true; // 날짜 검증 LocalDate startDate = null; LocalDate endDate = null; // 검색 시작일자와 종료일자가 있는지 체크 if (searchStartDate == null || searchStartDate.isEmpty() || searchEndDate == null || searchEndDate.isEmpty()) { isValid = false; } // 날짜 형식으로 변환 if (isValid) { try { startDate = LocalDate.parse(searchStartDate, SLUSH_FORMATTER); endDate = LocalDate.parse(searchEndDate, SLUSH_FORMATTER); } catch (Exception e) { isValid = false; } } // 시작일자가 종료일자보다 이후인지 확인 if (isValid && startDate.isAfter(endDate)) { isValid = false; } // 총 기간이 지정한 개월 수를 넘는지 확인 if (isValid) { long monthsBetween = ChronoUnit.MONTHS.between(startDate, endDate); if (monthsBetween >= months) { isValid = false; } } return isValid; } public static String setStrToDataFormatter(String str, String formatter) { // 입력 문자열을 LocalDateTime으로 변환 DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime dateTime = LocalDateTime.parse(str, inputFormatter); // 원하는 출력 포맷 적용 DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(formatter); String formattedDate = dateTime.format(outputFormatter); return formattedDate; } }

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up