Hi Ilkka,
bad news from the browser front:
Your proposed solution fails because the exported time string format
differs between browsers.
In every decent browser I tested (english or german versions) I have a
date string like "Wed Feb 10 2010 00:00:00 bla", while only in IE7 and
IE8 (german) I have "Wed Feb 10 00:00:00 bla 2010".
Test yourself, type this in your fav browser's URL input (and then in
your customers' company dictated browser-look-a-like):
javascript:var j = new Date(); alert(j.toString());
Although this makes parts of my body hurt, it appeared to be not such a
problem, as dealing with a native Date object would be more elegant:
var da = myDateField.getValue();
da.getFullYear() + ((da.getMonth() + 1).toString().length == 1 ? "0" :
"") + (da.getMonth() + 1).toString() + (da.getDate().toString().length
== 1 ? "0" : "") + da.getDate();
Although your using a regexp is cooler;-)
That said, after I read DateField.js, I found
this.getChildControl("textfield").getValue()
seems to return exactly what I need.
Still, if some qooxdoo gooroo(TM) knows another, official way, or anyone
just wanna approve the solution above, I'd be curious to listen.
Greetings,
Stefan
On 09.02.2010 19:10, Ilkka Oksanen wrote:
> Hi Stevan,
>
> This is not Qooxdoo related proposal but if you have the date as a sting
> in one format and want just to convert it to another format can't you
> just do:
>
> var date = "Tue Feb 09 2010 00:00:00 GMT+0100";
> var m=[];
>
> m["Jan"]="01";m["Feb"]="02";m["Mar"]="03";m["Apr"]="04";m["May"]="05";m["Jun"]="06";
> m["Jul"]="07";m["Aug"]="08";m["Sep"]="09";m["Oct"]="10";m["Nov"]="11";m["Dec"]="12";
>
> f = date.match(/^\w+ (\w+) (\d+) (\d+)/);
>
> var newdate = f[3] + "/" + m[f[1]] + "/" + f[2];
>
> alert(newdate);
>
> Or similar.
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel