JohnSi
johnsi1@gmail.com
Www c date at (90 views)
8 Oct 2026 17:32
Hallo, Gast!
Artikel über www c date at
How to Handle Dates in JSP. Date class is available in java.util package";"JSP Date Handling. In this article
I am going to discuss JSP Date Handling i.e.

>>> ZUR WEBSITE <<<
How to Handle Dates in JSP Applications. Please read our previous article
where we discuss File Uploading and Downloading in JSP with Examples. In JSP
we can use all the methods available in core Java. The Date class is available in java.util package which encapsulates the current date and time. It supports two constructors: Date(): It initializes the object with the current date and time. Date(long millisec): It accepts one argument that equals the number of milliseconds that have elapsed since midnight. Methods. boolean after(Date date) : It returns after the date of the current date parameter. boolean before(Date date): It returns the before the date of the given date parameter. Object clone() : It returns the duplicate of the invoking Date object. int compareTo(Date date): It compares the value of invoking object with the date and returns zero if the values are equal. int compareTo(Object obj) : It compares compareTo(Date) of obj is of class Date otherwise throws ClassCastException. boolean equals(Object date) : It returns true if both the date objects are equal otherwise returns false. long getTime() : It is used to fetch the time. int hashCode(): It is used to return a hash code of the invoking object. void setTime(longTime): It is used to set the time of the given date object. String toString(): It is used to convert the invoking Date object into a string and return the result. Current Date and Time in JSP. In this example
we are using the date object to fetch the current date and time. CurrentDate.jsp. Output. Date Comparison in JSP. Use getTime() method to get the number of milliseconds for both objects and then compare these two values. Use before()
after()
and equals() methods because the 12 th of the month comes before the 18 th and it returns true in this case. Use compareTo() methods which are defined by the Comparable interface and implemented by Date. Date Formatting using SimpleDateFormat in JSP. SimpleDateFormat class is used for formatting and parsing dates in a locale-sensitive manner which allows you to start by choosing any user-defined patterns for date-time formatting. Example: CurrentDate.jsp. Output. DateFormat Format Codes in JSP. Use a time pattern string to specify the time format where all ASCII letters are reserved as pattern letters. In the next article
I am going to discuss JSP Standard Tag Library (JSTL) . Here
in this article
I try to explain Handling Date in JSP with Examples . I hope you enjoy this Handling Date in JSP with Examples article. About the Author: Pranaya Rout. Pranaya Rout has published more than 3
000 articles in his 11-year career.
103.143.143.42
JohnSi
Guest
johnsi1@gmail.com