I think you should have your constructor
match the superclass, call super passing all the parameters, and then re-adjust
your value based on the timezone under the super call.
Matt
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ernest Wong
Sent: Monday, December 05, 2005
7:13 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Is there
any place for me to set the time zone?
Thank you Matt!
That means whenever I new a Date instance, I need
to get the GMT?
Is it possible to override the constructor of the
Date.as, so that I
can construct each date instance to a specific
timezone?
I have written a class that extends the Date:
class GMTHKDate extends Date{
function GMTHKDate(timeValue:Number)
{
if (timeValue == undefined ||
isNaN(timeValue))
timeValue =
super().getTime();
super(timeValue +
getTimeZoneOffSet());
}
public static function getTimeZoneOffSet()
: Number {
var tzOffSet = new
Date().getTimezoneOffset();
tzOffSet *= 60 * 1000;
tzOffSet += 8 * 60 * 60 * 1000;
// adjust to Hong Kong timezone
return tzOffSet;
}
}
It works, however Flex allows only one constructor.
How can I also
constructs something like:
function
Date(year:Number,month:Number,date:Number,hour:Number,min:Number,sec:Number,ms:Number);
?
Thank you very much!
Regards,
Ernest
--- In flexcoders@yahoogroups.com,
"Matt Chotin" <[EMAIL PROTECTED]> wrote:
>
> The Player uses the timezone of the user's
computer by default. You'll
> need to write your app to adjust
appropriately by adjusting the date
> using getTimezoneOffset.
> (http://www.macromedia.com/support/flash/action_scripts/actionscript_dic
> tionary/actionscript_dictionary163.html).
>
>
>
> Generally to get to GMT you can do
date.setMinutes(date.getMinutes() -
> date.getTimezoneOffset()) or something like
that (I did this once but
> this is not the code I used, you'll need to
play around to get it
> right).
>
>
>
> Matt
>
>
>
> ________________________________
>
> From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
> Behalf Of Ernest Wong
> Sent: Monday, December 05, 2005 3:18 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Is there any place for
me to set the time zone?
>
>
>
> Hi!
>
> I want to set a specific time
zone to my flex application.
> (Since different time zone may affect my
result data)
> I can't find the configuration of time zone
from the flex-config.xml.
> Is there any place I can set it?
>
> Please help me!
>
> Thanks a lot!
>
> Regards,
> Ernest.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS