Guys,

i am working on flex date. I am facing a small issue with that.

Flex date starts with 1st jan, 1970 and i want to make it start from 1st
Jan, 1960.

for that.. i have written some code.. but its behaving perfect in some
locales and for some locales, it's not.

Can anyone suggest, is can this be a locale issue ? or the code one?

the sample is code is below.

var d:Date = new Date(2008, 4, 1); // May 1, 2008
var baseDateTime:Number = flexDateToBaseDate(d.getTime()); // this function
will convert the base of date d from 1st Jan, 1970 to 1st Jan, 1960


the function flexDateToBaseDate is as below.

 public  static function flexDateToBaseDate(dateNum:Number):int{

            var flexDate:Date = new Date();
            flexDate.setTime(dateNum);
            flexDate.setHours(11,0,0,0);
            var date:Number = flexDate.getDate();
            var utcDate:Number = flexDate.getUTCDate();
            // if the UTC day is not correct, fix it.
            if (date != utcDate) {
                var year:Number = flexDate.getFullYear();
                var month:Number = flexDate.getMonth();
                flexDate.setUTCFullYear(year, month, date);
            }
            return (flexDate.getTime() - datediffOffset)/millisInDay;
        }


datediffOffset is calculated as below

             _baseYear= 1960;
             _date = new Date( _baseYeas, 0, 1, 0, 0, 0, 0 );
             _datediffOffset= _date.getTime();


can you please tell me, where am doing mistake?
-- 

Regards,
Nishant

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to