Java implements simple code for 'year month day morning and afternoon: minute: second'

  • 2020-04-01 04:07:12
  • OfStack

How to use the SimpleDateFormat class to format "year - month - day morning/afternoon: minute: second" date:


import java.text.SimpleDateFormat; 
import java.util.Date; 
 
public class Test { 
  public static void main(String[] args) { 
    System.out.println(new SimpleDateFormat("yyyy-MM-dd ahh:mm:ss").format(new Date())); 
  } 

  Above is the Java code to achieve "year - month - day morning/afternoon: minutes: seconds" all the content, the code is very simple, I hope to help you learn.


Related articles: