Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to get system date in as2

Community Beginner ,
Nov 26, 2013 Nov 26, 2013

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


TOPICS
ActionScript
711
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 26, 2013 Nov 26, 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.

Translate
LEGEND ,
Nov 26, 2013 Nov 26, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 27, 2013 Nov 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 01, 2013 Dec 01, 2013
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines