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.









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
current date in php
current date in php  PHP script to get current date.   Hi, You can use the following code to print the current in PHP:ADS_TO_REPLACE_1... the current date in a variable: <? $today = date("F j, Y, g:i a"); ?>
date_time_set
date_time_set date_time_set alias DateTime::setTime function resets the the current time of the DateTime object to a different time. It returns... $hour , int $minute [, int $second ] ) DateTime date_time_set ( DateTime $object
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 current date without system date
how to get current date without system date  is there any possiblity to get current date instead of system date in Java, as i dont want to change date in program and if i change date in OS automatically change in program also
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
getting current date without using system date - Date Calendar
getting current date without using system date  I want to get the current date but the Java code should not get System date as Current date. Pleae help me in getting current date without using system date. thanks in Advance
PHP Set Date
DateTime::setDate DateTime::setDate alias date_date_set function is used for resetting the current date of the DateTime object to a different date. It returns... $year, int $month, int $day ) DateTime date_date_set ( DateTime $object, int
Java current date - How to get current date in Java
In this section, you will learn about displaying current date and time in Java
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
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
J2ME Current Date And Time
.  In this Midlet we have set the current date and time as date & time... called Date & Time and set the current time and date as Item. Source Code... 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 date to a database table. The method setInt() set integer parameter
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
Current Date iPhone SDK
Current Date iPhone SDK In this example, you'll find out how to get current.... Code to set the date format in iPhone NSDateFormatter *dateFormat...;]; In this example, we aims to print the current day, current Date and first
Iphone Show Current Date & Time
Iphone Show Current Date & Time In the previous examples, we have printed current date and time separately in iphone simulator. But in this example we are going to show you how to print both current date and current time in iphone
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
date_timestamp_set
date_timestamp_set date_timsestamp_set alias DateTime::setTimestamp function is used for setting the date and time based on an Unix timestamp. Syntax... unixtimestamp - Unix timestamp representing the date. Return Values
iPhone Current Date, iPhone Current Date Application
; In this wesynthesize variable and also to display current date we use Stringwhich isdeclared... to display current dateon label by using Window based application. Creating...:NSDateFormatterNoStyle];ADS_TO_REPLACE_7    NSDate*date
Mysql Date from Date
an example from 'DateTime in Mysql'. To grasp this example, we use date(current_trimestamp ( )) query that return you the current date  from date time as Date...; mysql> select date(current_timestamp()) as Date; Output
Set Date limit for dojo date picker dynamically - Date Calendar
Set Date limit for dojo date picker dynamically  Hi all, I am using Dojo's date picker in my project. I am trying to set min & max value... picker. I had set min & max date for first field. Now whatever date select in first
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
date_timezone_set
date_timezone_set() in PHP date_timezone_set alias DateTime::setTimezone... the modified DateTime.  Syntax on date_timezone_set() PHP public DateTime DateTime::setTimezone ( DateTimeZone $timezone ) DateTime date_timezone_set
Mysql Date Name
; Mysql Date Name helps you to find out the current Date of the Month... you  in find out the current date of the month. date_format(now( ),'%e') : The Query return you the current date of the month.  Query for selecting date
store current system date in to database - Development process
store current system date in to database  Hi,this is my code . here iwant to store current system date in to database and want to store subdept..."].elements["combo2"].options.length=0; for (var i=0;i<% java.util.Date date
Mysql Date Arithmetic
Date Arithmetic is used to display the current date, interval in current date and time. Understand with ExampleADS_TO_REPLACE_1 The Tutorial..., we  run the select now ( ) query that return you the current date and time
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
How can we get second of the current time using date function?
How can we get second of the current time using date function?  How can we get second of the current time using date function
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
Mysql Date Query
; Mysql Date Query Date Query is used to return the current date, month and year... an example from 'Mysql Date Query'. To understand this example we use current_date query that return the current date in the table. Current_Date :The Query
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
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 Year of Date
; Mysql Year of Date is used to return the current year of the table... the following query (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 
Mysql Date Functions
; Mysql Date Functions return you the  current date, current... use curdate ( ) query that returns the current date as field name 'current date...) Query:- The Query below return you the current date ,current month 
Mysql Date no Time
; Mysql Date no Time is used to find out the current date with no time... no Time' in Mysql . In this Example, the date(now( ) ) return you the current date  with no time. date(now( ) ) : The date(now( ))  return you the current
Getting Previous, Current and Next Day Date
Getting Previous, Current and Next Day Date   ... previous, current and next date in java. The java util package provides... helps you to get the previous, current and next date to Date() constructor
Mysql Date Today
; Mysql Date Today show you Query to retrieve the current today date. ... the today current date. date (now ( )) : The Query now ( )   return you the current today date in Mysql. Query for finding the current date:-ADS
WANT TO RESTRICT EDITING AFTER A SET OF DATE
from "edit" existing data, after a set of date... an example, a user input...WANT TO RESTRICT EDITING AFTER A SET OF DATE  localhost : Server version: 5.0.51b-community-nt phpMyAdmin - 2.11.7 hello guys
Mysql Current TimeStamp
_date query that return you the current date of your database as Current_Date. Query for Current Date select CURRENT_DATE; ResultADS_TO_REPLACE_2 +--------------+ | CURRENT_DATE
Mysql Date Now
; Date Now in Mysql is used to find out the current date and time. Understand...'. In this example we help you to find out the current date and time in Mysql. The Syntax below returns you the current date and time: now ( ) :The now
How automatically calculate age based on date of birth and current date using jsp and servlet?
How automatically calculate age based on date of birth and current date using jsp and servlet?  when user enters the Date of birth in one textbox then automatically age will be display on another textbox. event:Onlick Event

Ads