Actionscript Date Extension Class

Over the past couple weekends, I’ve finally had the chance to finish up a class I started quite a while ago. I had made an extension to Flash’s Date class but there were a ton of things that I wanted to change/add to the class when I had the chance.

I finally was able to get it to a nice stopping point and I felt it was a good time to set the code free into the real world. While this class isn’t anything groundbreaking. It has a lot of really nice methods that will make date-based Flash applications a lot easier.

Here’s a list of the methods in this class, I think the names are fairly self-explanatory.

  • getDayOfWeek
  • isSunday
  • isMonday
  • isTuesday
  • isWednesday
  • isThursday
  • isFriday
  • isSaturday
  • isWeekend
  • setDaysInMonth
  • get daysInMonth
  • getDaysLeftInMonth
  • get daysInYear
  • monthStartDate
  • monthEndDate
  • setWeeksInMonth
  • getWeeksInMonth
  • get daysInWeeks
  • get daysInWeek
  • getDay
  • getDayName
  • getMonthName

Download XDate Class

I know XDate is a slightly cheesy name but it actually has a fairly logical reason. It was based off the naming convention I came up with that all extention classes start with an ‘X’. Please feel free to send me feedback.

The Discussion

9 Comments on “Actionscript Date Extension Class”

The download link is broken!

Just thought I’d let you know! But I found your file on actionscript.org too!


Fixed. Thanks for the find!



I’m having trouble getting the “daysinMonth” function to work. It keeps coming up with undefined. Can you give me some direction?


In Spanish it is not necessary to put articles before of the day name when formating dates.

private var dayNameSP:Array = new Array(”Domingo”, “Lunes”, “Martes”, “Miércoles”, “Jueves”, “Viernes”, “Sábado”);


Domenico - Apologies for my ignorance. Thanks so much for filling me in - I will make the changes on this when I update it to AS3.

Thanks again!


I know this is OLD.. but is there any documentation of this class? examples of its use?..etc..etc


[...] finish porting a Date Extension Utility class from AS2 to AS3. I think it was originally based on this one. This should normally be straighforward. First snag, Date is final…grrr. Okay so I’ll wrap an [...]


Hallo
Can you tell me from where i can download your Class?
The link in this article is down for me…help ;)

Thanks
P


Comment Love

Leave a comment, have 50 cents donated to a charity.

RSS Feed

Feed your RSS reader

Subscribe to Some Random Dude. It's nutritious.