Flex "Verbal Month" date

Hi All,

If you are working with Adobe flex, you probably know that the framework does not have a function such as DateTime.Now().ToString().

Because of that, displaying a friendly date to the user is impossible unless you write a small extension to the getDate() function in flex.

This is The way to go

   1: var todayDate:String = "";
   2:
   3: private function INIT():void{
   4:     getCurrentDate();
   5: }
   6:
   7: private var monthLabels:Array = new Array("Jan",
   8:                                           "Feb",
   9:                                           "Mar",
  10:                                           "Apr",
  11:                                           "May",
  12:                                           "Jun",
  13:                                           "Jul",
  14:                                           "Aug",
  15:                                           "Sep",
  16:                                           "Oct",
  17:                                           "Nov",
  18:                                           "Dec");
  19:
  20: private function getCurrentDate():void{
  21:     var date:Date = new Date();
  22:     todayDate = date.getDate().toString() + " " + monthLabels[date.getMonth()].toString() + " " + date.getFullYear().toString();
  23:     datePickerButton.label=todayDate;
  24: }
That’s it, its that easy to get a date from flex.

You can of curse extend it some more in order to get the day.

<img src="http://feeds.feedburner.com/~r/KensoDev-en/~4/FsVeZhSQAvw" height="1" width="1"/>
Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com