Simple Timestamp

PHOTO EMBED

Fri Feb 18 2022 17:41:15 GMT+0000 (Coordinated Universal Time)

Saved by @friedmacher #java

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class Start {
	// Define the format for the time stamp
    private static final SimpleDateFormat FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd");
    private static final SimpleDateFormat FORMAT_TIME = new SimpleDateFormat("HH:mm");
    
    public static void main(String[] args) {
        // Get the current date and time
        Timestamp timestemp = new Timestamp(System.currentTimeMillis());
        
      	// Output the timestamp formated as date and time
        System.out.println("Current Date: " + FORMAT_DATE.format(timestemp));
        System.out.println("Current Time: " + FORMAT_TIME.format(timestemp));
        
    }

}
content_copyCOPY