Look up the dateFormatter class (mx.formatters.DateFormatter). In your
format function, create an instance of it and supply it with the format string “DD\MM\YYYY”
and that should give you what you want.
Ta.
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Reto M. Kiefer
Sent: 01 August 2005 09:22
To: flexcoders@yahoogroups.com
Subject: [flexcoders]
date.getUTCMonth / date.getUTCDate with a leading zero
Dear all,
maybe I am simply do not see the crucial point but
I have a small
problem. In a form the users can enter some dates
via
<mx:DateField
id="compBop" dateFormatter="formatDate" />
The corresponding formatDate() looks like this
one:
function formatDate(date:Date):String
{
return (date.getUTCDate() + 1) + "-" + (
date.getUTCMonth() + 1 ) + "-"
+ date.getUTCFullYear();
}
This works quite good, but I want have a leading 0
if the Day or the
month conists of only on digit, e.g. 02 instead of
2 for february.
I searched all the variants of date.UTC....() but
did not saw an option
for this. I assume there is one because you can
have the year displayes
with 4 or 2 digits...
Maybe some is so helpful and can provide me with
the proper function
call or a workaround if there is no such a call.
Thanks in advance and best regards
Reto
--
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
|
- RE: [flexcoders] date.getUTCMonth / date.getUTCDate with a ... Michael Herron
-