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

how to get the time in java

// get current time in java using LocalTime.now() method 
import java.time.LocalTime;
public class UsingLocalDate
{
   public static void main(String[] args)
   {
      System.out.println(LocalTime.now());
     // hr : min : sec.fimto sec
   }
}
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

java get current time in seconds

LocalDateTime date = LocalDateTime.now();
int seconds = date.toLocalTime().toSecondOfDay();
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 :: glide dependency android java 
Java :: how to set 2 decimal places in java 
Java :: android studio float to int 
Java :: swing enter key 
Java :: java generic array 
Java :: append button jframe 
Java :: Convert c# to xml string 
Java :: Unhandled exception: java.lang.InterruptedException 
Java :: java int length 
Java :: adding 2 variable in java 
Java :: how to reverse a list in java 
Java :: how to delete files in java 
Java :: how to iterate hashset in java 8 
Java :: access activity method from adapter 
Java :: send variable intent 
Java :: how to change maven java version in po, 
Java :: how to create a random number in java 
Java :: find if a number is in a 2d array java 
Java :: change button text when clicked android studio 
Java :: java swing alert window 
Java :: java get random char from alphabet 
Java :: java get constructor 
Java :: joptionpane 
Java :: JAVA_HOME not found in your environment. 
Java :: java generate secure random password 
Java :: Java Hashmap Access Elements 
Java :: region in android studio 
Java :: how to find the average in an arraylist 
Java :: what language is android written in 
Java :: open gallery android 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =