Answers for "date format example"

12

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));
  }  
}
Posted by: Guest on June-03-2020
0

format date

const formatDate = date => {
  return (
    date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  );
};

console.log(formatDate(new Date()));
Posted by: Guest on September-13-2021
0

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
Posted by: Guest on June-14-2021

Code answers related to "date format example"

Browse Popular Code Answers by Language