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 how to get current time

import java.util.Calendar;
Date currentTime = Calendar.getInstance().getTime();
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 :: set source image in android studio 
Java :: default argument in java 
Java :: javac clear 
Java :: integer.tostring java 
Java :: java store hexadecimal value 
Java :: intent in java 
Java :: android studio change launcher icon 
Java :: how to run individual test in java maven 
Java :: java iterator to stream 
Java :: creating a directory using java 
Java :: difference between two LocalDateTime java 
Java :: how to use sql file in java 
Java :: Concept of Association in java 
Java :: how to change actionbar color in android programmatically 
Java :: spring db properties 
Java :: android sha1 key 
Java :: java convert float to double 
Java :: boucle for avec un tableau java 
Java :: Could not determine java version from 
Java :: get all keys from pbject javascirpt 
Java :: java class jar determine 
Java :: android menu change text color 
Java :: string array to stringbuilder array java 
Java :: check if a list contains a string java 
Java :: java iterate map and remove 
Java :: java get jar execution directory 
Java :: string methods in java 
Java :: mac java version terminal 
Java :: initialize an array in java 
Java :: print double without decimal java 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =