Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Date-Calendar current date set

Have Programming Question? Ask it here!
 
 
 


Chamika Dilhani
current date set
1 Answer(s)      a year and a month ago
Posted in : Date-Calendar


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.


Advertisement
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: <?php echo date('y m d'); ?> With the help of following code you can get the current date
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 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
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
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
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
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
Java current date - How to get current date in Java
In this section, you will learn about displaying current date and time in Java
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     
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 
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
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
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
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
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 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];    NSDate*date =[NSDatedate];  //toprint date
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
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
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
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
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
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 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
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
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 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
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... the previous, current and next date to Date() constructor of java.util package
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
Write an Applet which display current date and time on the web page??
Write an Applet which display current date and time on the web page??  Write an Applet which display current date and time on the web page?  Here is an applet code that display date and time. import java.applet.
Write an Applet which display current date and time on the web page??
Write an Applet which display current date and time on the web page??  Write an Applet which display current date and time on the web page??  Here is an applet code that display date and time. import java.applet.
WANT TO RESTRICT EDITING AFTER A SET OF DATE
to restrict user from "edit" existing data, after a set of date... an example...WANT TO RESTRICT EDITING AFTER A SET OF DATE  localhost : Server version: 5.0.51b-community-nt phpMyAdmin - 2.11.7 hello guys, i have
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
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 Current TimeStamp
an example from 'Mysql Current TimeStamp'. To understand, we use current_date query that return you the current date of your database as Current_Date. Query for Current Date select CURRENT_DATE; Result
Display current date in text box in JSP using javascript
Display current date in text box in JSP using javascript In this section you will learn how to display current date in text box using JavaScript.For... element through id attribute and used the value property to store the current date
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
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
Display Current Date using JSP Custom(user define) Tag
Display Current Date using JSP Custom(user define) Tag In this section, we will discuss about how to display current date & time using  custom(user... page Deploy the application EXAMPLE : In this Example, Current date
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
Mysql Date Today
; Mysql Date Today show you Query to retrieve the current today date. ... date. date (now ( )) : The Query now ( )   return you the current today date in Mysql. Query for finding the current date:- mysql>
Advertisements
 

 

 

DMCA.com