Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

taking date as input in java

import java.text.SimpleDateFormat;
import java.util.Date;
public class StringToDateExample1 {
public static void main(String[] args)throws Exception {
String sDate1="31/12/1998";
Date date1=new SimpleDateFormat("dd/MM/yyyy").parse(sDate1);
System.out.println(sDate1+"	"+date1);
}
Comment

input date in java

import java.text.SimpleDateFormat;
import java.util.*;

class class_name
{
    public static void main(String[] args) throws Exception // You can also use try-catch blocks.
    {
      System.out.println("dd-mm-yyyy");
      Scanner scanner = new Scanner(System.in);
      String date = scanner.nextLine();
      Date date1=new SimpleDateFormat("dd-MM-yyyy").parse(date);  
      System.out.println(date1);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: convert class to xml string 
Java :: jackson object to string 
Java :: android studio get string 
Java :: java for range loop 
Java :: change text color in joptionpane 
Java :: get file extension java 
Java :: spring enable cors 
Java :: android save int 
Java :: how to truncate an array in java 
Java :: bufferedreader for input in java 
Java :: How to create a disjoint-set data structure, in Java? 
Java :: retrofit dependency in android studio 
Java :: java discord bot get id of message it just sent 
Java :: java regex ip 
Java :: into to string in java 
Java :: java.lang.Long cannot be cast to java.lang.Integer 
Java :: java set label color 
Java :: isnumber java 
Java :: random number between 1 and 100 java 
Java :: hanoi tower java 
Java :: java stream order by property 
Java :: bukkit Command sender is player 
Java :: create new java swing button 
Java :: print random from list java 
Java :: sum of arraylist java 8 
Java :: how to add to a file in java 
Java :: convert int to string java 
Java :: iterator java 
Java :: SendKeys issues with numbers(Int) 
Java :: java convert string to int array 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =