How to display current date in textbox

How to display current date in textbox

View Answers

November 21, 2009 at 10:29 AM

Hi Friend,

Try the following code:

<script>
function addDate(){
date = new Date();
var month = date.getMonth()+1;
var day = date.getDate();
var year = date.getFullYear();

if (document.getElementById('date').value == ''){
document.getElementById('date').value = day + '-' + month + '-' + year;
}
}
</script>
<body onload="addDate();">
Today's Date is: <input type="text" id="date">
</body>

Thanks

February 2, 2012 at 12:46 PM

very helpful code for beginners like me. Thank you very much.









Related Tutorials/Questions & Answers:
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
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
Advertisements
How to display the current time
How to display the current time  I was develop online web portal. In this web portal i am going to display time. I am using <%= new java.util.Date() %> to display the time. But it display the time after that cannot changed
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
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 display date in JSP?
How to display date in JSP?  How to create a simple JSP program which displays date on the page? Thanks   Hi, You should import...; Then use the following code to print the current date: <%= new java.util.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
How to display date in JSP?
How to display date in JSP?  How to create a simple JSP program which displays date on the page? Thanks
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
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... In this Example, Current date & time will display using custom tag. Tag
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.
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 on textbox using ObjectUtil class
How to display on textbox using ObjectUtil class       In this tutorial we will see how to display a text in textbox using ObjectUtil class. Here
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
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE  Dear sir, Am having one table called rolemaster. In that there are 2 fields... is how to get Roleid in textbox when i select Role_name from combobox in a same
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
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
date in textbox on page load
date in textbox on page load   i want to insret the current date...;/html>   Here is a javascript code that insert the current date into textbox on page load. <html> <script> function addDate(){ date = new
Current date in php
Current date in php  How to show the current date in the HTML page using PHP Script
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 textbox value based on selected option value?
how to display textbox value based on selected option value?  Hi,I have some problem. I use jsp and ajax. first select: 1 second select:2 based on first value I finished above code. ID: xx Name:xx xx is baesd on second
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
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
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 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
display he new customer no in textbox
display he new customer no in textbox   i want to add the new customer for that when i click on add butto the new customernumber should be display in textfield . plz ell me the suggestions & code
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
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"); ?>
Write date servlet and test on tomcat
Display the current date with a Servlet  ... to display a current date and current time on the client browser.  It is very easy to display current date with the help of a servlet program using
display data from database in textbox when id entered in textbox
display data from database in textbox when id entered in textbox  i wanted to enter data in textbox .depending on entered data in textbox data from database should be displayed dynamically in textbox
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
get date picker values to a textbox
get date picker values to a textbox  I am using DatePicker to select date in a form in asp.net using c#. I need the picked data to get in to a textbox. Please help me soon
Display Date - Java Beginners
to display day,date,year and current time. import java.util.*; class DateExample { public static void main(String[] args) { Date date = new Date...Display Date  Plz send me sample java program that display day, 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
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... of PreparedStatement. And to insert current date to database, we have created an instance
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
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 
Get Date and Time
;    In the example given below we will see, how to display current date and time in the user given format. To do all this we have first... whose time fields have been initialized with the current date and time. getTime
Mysql Date Format codes
'. In this example we let you know ,how to display the current date and time in the system. The now ( ) as Date is used to display the current date, month, year and time... the current week, day, month and year. mysql> select date_format(now(),'%W
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
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
Current Date iPhone SDK
Current Date iPhone SDK In this example, you'll find out how to get current date & day in iPhone SDK. We'll also write a method to print the day and date...;]; In this example, we aims to print the current day, current Date and first
Only Display Date
Only Display Date  I want to implement only date not time like that 20 Sep 2011. How can possiple it?   Your question is not clear. Which technology you use? java/.NET/SQl
display current time when using datetimepiker in struts2
display current time when using datetimepiker in struts2  how to display current time when using datetimepiker in struts2 I set displayFormat="dd/MM/yyyy HH:mm:ss" but it doesn't work. Display value is always : 19/11/2010 00:00
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 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
SQL display date in between query
SQL display date in between query  how to get ( 15 march 2011) and (15/03/2011) output using SQL

Ads