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 :: java joptionpane input 
Java :: make recycler view non scrollable 
Java :: appcompatdelegate.setdefaultnightmode(appcompatdelegate.mode_night_yes) not working 
Java :: java 8 remove spaces from string 
Java :: java kommentointi 
Java :: java int to hex fixed length 
Java :: java test if a string is a int 
Java :: geting max value in priority queue java 
Java :: rwegex java 
Java :: bloomreach remove property 
Java :: list to lowercase java 
Java :: xAxis.setTextSize() text gets clipped 
Java :: android volley 
Java :: How to efficiently find the middle node of a singly linked list, in Java? 
Java :: how to build a java main menu 
Java :: programmation android avoir acces à la liste des instants de partage 
Java :: closest fraction to pi 
Java :: create map java 
Java :: collect as arr java 8 
Java :: android java toast 
Java :: java random Double between 
Java :: java ee check if session exists or is new 
Java :: input date in java 
Java :: get file extension java 
Java :: how to truncate an array in java 
Java :: find duplicate value in array using java 
Java :: How to efficiently find the highest power of 2 dividing a given number, in Java? 
Java :: how to instantiate hashmap in java 
Java :: java set label color 
Java :: encode file to base64 java 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =