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 :: Unable to find bundled Java version. 
Java :: print a to z in java 
Java :: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null 
Java :: hashmap.foreach example 
Java :: anagram java program 
Java :: java check if divisible 
Java :: java random string 
Java :: spigot execute command as player 
Java :: java int to int array 
Java :: How to efficiently find the highest power of 2 dividing a given number, in Java? 
Java :: java array loop backwards 
Java :: into to string in java 
Java :: how to reset jframe java swing 
Java :: how to check if a char is a letter java 
Java :: double min value java 
Java :: swap function java 
Java :: How to perform counting sort in Java? 
Java :: java 2d array loop 
Java :: java boolean 2d array 
Java :: how to add music to java 
Java :: shell sort java 
Java :: char array to string java 
Java :: java find longest string in list 
Java :: how to reverse a string in java 
Java :: how to create a circle in java 
Java :: get random string from array list 
Java :: len of number in java 
Java :: jsonarray to list java 
Java :: install java debian 8 
Java :: get type java 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =