Skip to main content
Known Participant
November 27, 2013
Answered

how to get system date in as2

  • November 27, 2013
  • 1 reply
  • 741 views

this is not working


var currDate:Date = new Date();

txtTest.text = currDate; box is empty

also when I find something that works, to parse out yyyy mm and dd

I have seen these examples, not sure at this point which one would work or both?

var currentDate=new Date();

var month=currentDate.getMonth();

var day=currentDate.getDate();

var year=currentDate.getFullYear();

or

var mm = currentDate.month

var yyyy = currentDate.fullyear

var dd = currentDate.day

I need to assemble the date like this: yyyymmdd, using it for date compares


This topic has been closed for replies.
Correct answer Ned Murphy

If the first code you showed is not displaying the date, then your problem is likely with what you have done for the textfield... the code works when the textfield is properly configured.

Make sure you are assigning the instance name to the Textfield where it says Instance Name in the properties panel.  Make sure the color of the text in the textfield is not the same as the background color.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
November 27, 2013

If the first code you showed is not displaying the date, then your problem is likely with what you have done for the textfield... the code works when the textfield is properly configured.

Make sure you are assigning the instance name to the Textfield where it says Instance Name in the properties panel.  Make sure the color of the text in the textfield is not the same as the background color.

bbxrider1Author
Known Participant
November 27, 2013

so I assume from your reply the code is correct.

I have used that textbox many times to display values for code I am testing.

Ned Murphy
Legend
December 2, 2013

The first code you showed is correct for a textfield named txtTest.  I don't see anything trying to utilize the rest of the code so I haven't answered for whatever you've done with that.