java simpledateformat example
String pattern = "yyyy-MM-dd";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String date = simpleDateFormat.format(new Date());
System.out.println(date);
java simpledateformat example
String pattern = "yyyy-MM-dd";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String date = simpleDateFormat.format(new Date());
System.out.println(date);
java date time
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
public class CurrentDateTimeExample1 {
public static void main(String[] args) {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
}
}
date format example
Pattern Result
---------------- -------
DateFormat.yMd() -> 7/10/1996
DateFormat('yMd') -> 7/10/1996
DateFormat.yMMMMd('en_US') -> July 10, 1996
DateFormat.jm() -> 5:08 PM
DateFormat.yMd().add_jm() -> 7/10/1996 5:08 PM
DateFormat.Hm() -> 17:08 // force 24 hour time
operation sur les dates java
dtEndDate.getTime() - dtStartDate.getTime()
java simpledateformat example
String pattern = "yyyy-MM-dd";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us