# Add Current Date to Input Fields

**URL:** <https://forum.kirupa.com/t/add-current-date-to-input-fields/64745>\
**Category:** flash\
**Created:** [September 19, 2004, 2:11pm UTC](https://forum.kirupa.com/t/add-current-date-to-input-fields/64745 "2004-09-19T14:11:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tajmahal](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tajmahal](https://forum.kirupa.com/u/tajmahal)\
**Post date:** [September 19, 2004, 2:11pm UTC](https://forum.kirupa.com/t/add-current-date-to-input-fields/64745/1 "2004-09-19T14:11:26Z")

</div>

Ok so i’ve got three text boxes in which i need the current date to display (one text box for the year, one for the month, one for the day). Simple, no? The only issue i’m having is i need to have a provision for users to change the date in these text boxes. So basically i need three input boxes that display the current date (one input box for year, one for month, one for day). However I cant find any way to do this. All the tutorials (even the one on this site) only puts the date into dynamic text boxes. If i try changing my boxes to Input Text boxes…well the date still displays, but it can’t be modified like in a normal Input Box.

Here’s the code i’m using (pretty simple):

```auto
 
onClipEvent (enterFrame) {
	theDate = new Date();
	theMonth = theDate.getMonth();
	theDay = theDate.getDate();
	theYear = theDate.getFullYear();
	yearField = theYear;
	monthField = theMonth;
	dayField = theDay;
}

```

yearField, monthField, and dayField are the Input Boxes where i want the date to display. However i want the input boxes to retain thier ability to be changed and edited to the user’s will.

I’d appreciate any ideas to solve this problem. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 5:58am UTC](https://forum.kirupa.com/t/add-current-date-to-input-fields/64745/2 "2004-09-20T05:58:32Z")

</div>

Hi

Here is the code just try this:

da = new Date();  
mon = [“Jan,”,“Feb”,“Mar”,“Apr”,“May”,“Jun”,“Jul”,“Aug”,“Sep”,“Oct”,“Nov”,“Dec”];

date1.text = da.getDate()  
date2.text = mon[da.getMonth()]  
date3.text = da.getFullYear()

//date1, date2, date3 are the names given to the Input textFields.

* * *

aShIsH
