You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.gcc.pospostdata.service;
import org.springframework.stereotype.Service;import java.time.LocalDateTime;import java.time.format.DateTimeFormatter;
@Servicepublic class DateTimeUtil { public static String getCurrentDateTime() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ddMMyyyyHHmmss"); LocalDateTime now = LocalDateTime.now(); return now.format(formatter); }
public static String getCurrentYear() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); LocalDateTime now = LocalDateTime.now(); return now.format(formatter); }
public static String getCurrentMonth() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); LocalDateTime now = LocalDateTime.now(); return now.format(formatter); }
public static String getCurrentDay() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd"); LocalDateTime now = LocalDateTime.now(); return now.format(formatter); }
public static String getCurrentDateTimeMysql() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime now = LocalDateTime.now(); return now.format(formatter); }}
|