user1152871
user1152871

Reputation: 31

Actionscript timestamp string representation

I need to get a string representation of the current timestamp in format YYYY-MM-DDThh:mm:ssZ

Upvotes: 3

Views: 1740

Answers (1)

Marty
Marty

Reputation: 39466

See the Date class, and the following properties (in order based on your question):

  1. fullYear
  2. month
  3. date
  4. hours
  5. minutes
  6. seconds

var date:Date = new Date();
var answer:String = date.fullYear + "-" + (date.month+1) + "-" + date.date + " " + date.hours + ":" + date.minutes + ":" + date.seconds;


trace(answer); // 2012-1-17 10:48:41

Upvotes: 6

Related Questions