Date

26 views
Skip to first unread message

madhusudhan sb

unread,
May 24, 2007, 8:25:51 AM5/24/07
to flex_...@googlegroups.com
Hi Everyone,

Please help me in finding the previous date by having the current date object.
private var today:Date = new Date();
I also wanted to know the previous week's start date and end date i,e. MON - SAT.

Thanks.
Madhu

madhusudhan sb

unread,
May 24, 2007, 8:25:51 AM5/24/07
to flex_...@googlegroups.com

mrinal wadhwa

unread,
May 24, 2007, 11:20:36 AM5/24/07
to flex_...@googlegroups.com

Ajay k

unread,
May 24, 2007, 11:37:37 AM5/24/07
to flex_...@googlegroups.com
For Finding the Previous Date  Please Subtract 24 Hours

//Gets The prevDate
public function prevDate():void
            {

               
                 var today:Date = new Date();
                 var yesterday:Date = new Date();
              
               //Subtract 24 hours
               yesterday.hours = int (today.getHours) - 24 ;
               
                Alert.show(today.toString());
                Alert.show(yesterday.toString());
            }


On 5/24/07, madhusudhan sb < madhusu...@gmail.com> wrote:



--
Ajay K

madhusudhan sb

unread,
May 25, 2007, 7:35:51 AM5/25/07
to flex_...@googlegroups.com
Thanks for the your reply.

I also tried the code below and its working.

[Bindable]
        private var millisecondsPerDay:int = 1000 * 60 * 60 * 24;

yesterday = new Date(today.getTime() - millisecondsPerDay);

Can someone tell me how to get the previous month's first date.
ex: I have the date object for 2007/01/10 and I want the function which returns 2006/12/01

Thanks.
Madhu
Reply all
Reply to author
Forward
0 new messages