Skip to main content
Inspiring
August 19, 2006
Question

Questions about Date in flash

  • August 19, 2006
  • 2 replies
  • 183 views
Hi everyone,

I'm doing an experimental Blog now and having some difficulties about Date in Flash.

What I'm trying to do is to seperate each months into weeks.
So let's say I want to display my blog in August. Since August has 5 weeks, I want to display all entries in 5 different tables. Each table represents week. So the first table will only show 6 entries, because the first week of August begins tuesday (aug 1) and ends Sunday (Aug 6).

The second table will display 7 entries and so forth.

Is this possible?

thank you
This topic has been closed for replies.

2 replies

Inspiring
August 20, 2006
The code below will find the first day and last day of the month. It has trace statements that will output a message on where to create code for these tables and entry fields that you plan to have. I don’t know if you need to create these tables/entries for the whole year or not, if so then you need to change the month parameter for the Date object constructor.
The_350ZAuthor
Inspiring
August 21, 2006
Oh thanks alot guys!!
I'm sorry for such a late reply, I was away for a fewdays without a computer.

But thanks alot, I really appreciate it!!!
Inspiring
August 20, 2006
Yes it is doable. Check the help filed for the Date class. There you will find the getDay() method. This returns an integer representing the day of the week a given date will fall upon. It starts 0 for Sunday, 1 for Monday, and so on.

So to figure out which day August 1, 2006 was you would do this:

myDate=new Date(2006,7,1)//Remember months start at 0 for Jan
startDay=myDate.getDay();
trace(startDay)//Should be 2 for Tuesday

Also a nice trick is this:

myDate=new Date(2006,7,0);

That gives you the zeroth day for August which is really the last day of July. I'm sure you will find a million uses for that.