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 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

get today date in java 8

LocalDate localDate = 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 :: kotlin variable in string 
Java :: add stringarrays to string list java 
Java :: android studio, not loading url in webview 
Java :: vscode java.home path 
Java :: how do i print text in java 
Java :: java how to cast int to String 
Java :: jacoco code coverage 
Java :: java replaceall regex 
Java :: remove fragment from backstack 
Java :: java bigdecimal check less zero 
Java :: jpa default value enum 
Java :: set java home sdk macbook 
Java :: Why should we mention a method throws some exception/s? 
Java :: java summe array 
Java :: kjk;ok 
Java :: retrofit implementation 
Java :: Java make numbers 
Java :: java stream distinct by object atribute 
Java :: arraylist of arraylist 
Java :: arraylist items into string 
Java :: java empty array 
Java :: concat result of List to one text java 
Java :: declaration of double array in java 
Java :: java comments 
Java :: get year month day from date string java 
Java :: remove first and last character from string in java 
Java :: check how many times a character appears in a string java 
Java :: java enums 
Java :: testing the web layer without authentication spring 
Java :: connect sqlite for java 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =