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
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”Charles-Philippe
14.02.06 7:04 pmThe download link is broken!
Just thought I’d let you know! But I found your file on actionscript.org too!
somerandomdude
15.02.06 10:11 amFixed. Thanks for the find!
Actionscript Classes » XDate
29.08.06 4:01 pm[...] http://www.somerandomdude.net/blog/flash/actionscript-date-extension-class/ [...]
brock
22.09.06 8:28 pmI’m having trouble getting the “daysinMonth” function to work. It keeps coming up with undefined. Can you give me some direction?
Domenico Zimbalero
11.04.07 8:37 amIn 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”);
somerandomdude
11.04.07 9:11 amDomenico - 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!
xl97
8.09.08 10:23 amI know this is OLD.. but is there any documentation of this class? examples of its use?..etc..etc
Flash: Date+ Final + DescribeType + lack of IDate = Bug? Rant! : TroyWorks
7.11.08 12:51 am[...] 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 [...]
Peter_D
18.05.09 11:52 pmHallo
Can you tell me from where i can download your Class?
The link in this article is down for me…help
Thanks
P
$0
Leave a comment, have 50 cents donated to a charity.