current date set

current date set

I need to set current date as default in a drop down list which has a label tag too in my jsp page.please somebody help me.

View Answers

June 12, 2013 at 11:49 AM

hi friend,

Try the following code, may this will be helpful for you.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.text.SimpleDateFormat, java.util.Date, java.text.DateFormat" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Drop Down List Example</title>
</head>
<body>
<%
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(
            "dd-MM-yyyy");
String formattedDate = sdf.format(date);
System.out.println("2. " + sdf.format(date));
%>
<h3>Display Current Date In Dropdownist</h3>
<table>
<tr>
<td>Select Date From List :</td>
<td><select name="crDate">
<optgroup label="Current Date">
    <option value="<%=formattedDate %>"><%=formattedDate %></option>    
  </optgroup>
</select>
</tr>
</table>
</body>
</html>

Thanks.

Ads









Related Tutorials/Questions & Answers:
current date set
current date set  I need to set current date as default in a drop down list which has a label tag too in my jsp page.please somebody help me
convert current date into date format
convert current date into date format  How to get current date and convert into date format in Java or PHP
Advertisements
Current date in php
Current date in php  How to show the current date in the HTML page using PHP Script
Iphone Current Date Application
Iphone Current Date Application  Hi, I am a beginner in the mobile web application segment. How can i develop Iphone Current Date Application. I need the online help guide or example about iphone current date format. Thanks
javascript current date and time.
javascript current date and time.  How can we display current date...;Current date and time</title> </head> <script type="text/javascript... write new Date() it shows the current date in standard format
JDBC : Current Date
JDBC : Current Date In this section, you will learn query for current date. Display Current Date : There are various methods provided by MYSQL to get current date. These are CURRENT_DATE, CURRENT_DATE(), CURRENT_TIMESTAMP, CURRENT
How to get the current date in Java?
How to get the current date in Java?  Hi, I am new to Java and trying to write a program to get the current date. How to get the current date in Java? Thanks   Hi, Check the tutorial: Java program to get current date
Java current date - How to get current date in Java
In this section, you will learn about displaying current date and time in Java
How to display current date in textbox - Date Calendar
How to display current date in textbox  Hi guys, I'm really need your...;% } This is my problem: I want to display current date in textbox... Date(); var month = currentTime.getMonth() + 1; var day
Getting the current date
Getting the current date     ... the current date in the proper format (Day/Month/Year). This program shows the current date by using the various methods and fields of the Calendar class
J2ME Current Date And Time
.  In this Midlet we have set the current date and time as date & time... see that we have created a form called Date & Time and set the current time... J2ME Current Date And Time     
Insert current date into MYSQL database
Insert current date into MYSQL database In this tutorial, you will learn how to insert current date into database. In most of the applications.... And to insert current date to database, we have created an instance of Date class
Get current Date and Time
Get current Date and Time In this section we will discuss about how to get current date and time in java. Java provide two classes, Date and calendar which will display the current date and time in java. SimpleDateFormat is used 
date format to be updated with current date time
date format to be updated with current date time  package LvFrm...; JButton b1,b2; //for date month year entry String strD[]={"Day","1...); /*for date entry & adding date into panel 2 also addind panel
updated with current date n time
updated with current date n time  package LvFrm; import...; //for date month year entry String strD[]={"Day","1","2","3","4","5...); panel2.setBorder(b2); frm.add(panel2); /*for date entry
c# current date in yyyy-MM-dd format
c# current date in yyyy-MM-dd format  Hi, How to get the current date in the format like 2021-01-12? I have to get the date into Year-Month-Date format. In c# how to get current date in yyyy-mm-dd format? Thanks   
Mysql Date from Date
in Mysql'. To grasp this example, we use date(current_trimestamp ( )) query that return you the current date  from date time as Date field name. Query:-     mysql> select date(current
Find whether a date will be in the current quarter or the next quarter
Find whether a date will be in the current quarter or the next quarter   I have a date - example - 22-09-2012(start date) I have to find my end date based on the current quarter My input are month of the quarter which is a list
JDBC: Get current Date and Time Example
JDBC: Get current Date and Time Example In this section, you will learn how to get current Date and current time using JDBC API. Get current Date and Time : CURDATE() : For current date you can use CURDATE(). It returns current date
Set Date Parameter to get specific value
Set Date Parameter to get specific value  How to set the date parameter or fetch a specific data records based on date? For example fetching the two or three months old records
Mysql Date Name
; Mysql Date Name helps you to find out the current Date of the Month... the current date of the month. date_format(now( ),'%e') : The Query return you the current date of the month.  Query for selecting date from the current
Mysql Date Arithmetic
Date Arithmetic is used to display the current date, interval in current date and time. Understand with Example The Tutorial illustrate... the select now ( ) query that return you the current date and time. SYNTAX:-date
how to display(update) current date and month in select box on selecting the year.
how to display(update) current date and month in select box on selecting the year.  how to display(update) current date and month in select box on selecting the year
Mysql Date Query
; Mysql Date Query Date Query is used to return the current date, month and year... 'Mysql Date Query'. To understand this example we use current_date query that return the current date in the table. Current_Date :The Query is used
Java program to get current date
Java program to get current date now  ... the current date at present now. We have used Calendar class for getting the current...;currentDate = Calendar.getInstance(); gets current date instance. To show
How to convert current date to dd mm yyyy format in Java?
How to convert current date to dd mm yyyy format in Java?  Hi, How to convert current date to dd mm yyyy format in Java? In my program I have to display the current date in the dd-mm-yyyy format to user on the website. How
Mysql Year of Date
; Mysql Year of Date is used to return the current year of the table... (current_date) that return the current year of  the table. Current_Date: The Query is used to return the current year of the date in a  table as fieldname
How to format current date into yyyy-mm-dd in Java
How to format current date into yyyy-mm-dd in Java  Hi, I have... database.I am searching code formatting the current date into this format. I have to do this in Java Programming Language. How to format current date
How to convert current date to mm dd yyyy format in Java?
How to convert current date to mm dd yyyy format in Java?  Hi, How to convert current date to mm dd yyyy format in Java? Share me the program... for converting current date into MM-dd-yyyy format. Here is full code: package
Mysql Date Functions
; Mysql Date Functions return you the  current date, current... ( ) query that returns the current date as field name 'current date'. Query... row in set (0.00 sec) Query:- Till this you know how to get the current
Mysql Date no Time
; Mysql Date no Time is used to find out the current date with no time... . In this Example, the date(now( ) ) return you the current date  with no time. date(now( ) ) : The date(now( ))  return you the current year, month

Ads