Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java how to get current date

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));  
  }    
}   
Comment

java get current date string

String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date());
Comment

java Date get today date

SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Date today = new Date();
System.out.println(formatter.format(today));
Comment

java get current date

SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");  
Date date = new Date();  
System.out.println(formatter.format(date));  

// ------------------------

System.out.println(LocalDate.now()); 
Comment

how to get current date in java

long millis=System.currentTimeMillis();  
java.sql.Date date=new java.sql.Date(millis);  
System.out.println(date);
Comment

PREVIOUS NEXT
Code Example
Java :: convert string to int java 
Java :: java print treemap 
Java :: android java increment hashmap value 
Java :: array to map java1 
Java :: how to print a matrix in java 
Java :: how to reverse order of arraylist 
Java :: error: package android.support.v4.content does not exist import android.support.v4.content.FileProvider; ^ 
Java :: get drawable with string android java 
Java :: reduce opacity of image in imageview in android 
Java :: java math.pi 
Java :: listview refresh android adapter 
Java :: java itemstatechanged called twice 
Java :: java how to get fps 
Java :: date to string java 
Java :: android settextcolor programmatically 
Java :: java create date object from yesterday 
Java :: how to take input in java 
Java :: java double to string with 2 decimals 
Java :: jfilechooser file filter 
Java :: how to set lowered bezels in jlabel 
Java :: java ee schedule every 10 seconds 
Java :: find all possible substrings of a string java 
Java :: get sha key android 
Java :: right click java 
Java :: android studio java toast 
Java :: Java get list of keys Hashmap 
Java :: spring xml 
Java :: org.springframework.orm.jpa.EntityManagerHolder cannot be cast to org.springframework.orm.hibernate5.SessionHolder 
Java :: firestore add to field array 
Java :: jsp import 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =