Skip to main content
Known Participant
January 5, 2016
Answered

Dates to Text Box

  • January 5, 2016
  • 1 reply
  • 613 views

I have a date something like this below.  I want to convert it so that I can put it into a text field.  Anyone know how to do this?  Thanks.

var currentDate=new Date();

  var month = currentDate.getMonth() + 1;

  var day = currentDate.getDate();

  var year = currentDate.getFullYear()

  trace(month + "/" + day + "/" + year);

This topic has been closed for replies.
Correct answer kglad

embed your font.

1 reply

kglad
Community Expert
Community Expert
January 5, 2016

use:

var currentDate=new Date();

  var month = currentDate.getMonth() + 1;

  var day = currentDate.getDate();

  var year = currentDate.getFullYear()

your_textfield.text=month + "/" + day + "/" + year;

Known Participant
January 5, 2016

i am using a Dynamic Text field and I get an empty box when I use that.  However if i put a word in quotes "Hello" it shows up no problem.

EDIT

if I open a new document and use that code it works perfectly.  Just not in the document I am working on.  Any ideas why that would be?

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 5, 2016

embed your font.