PDA

View Full Version : Date and time



new2extjs
1 Sep 2011, 7:31 AM
Hi
I am looking for a function like
echo (date("d/m/y : H:i:s", time()) );
which diplays new value every time we refresh.

Isn't there similar function in extjs?

Thanks in advance.

tobiu
1 Sep 2011, 8:00 AM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Date

new2extjs
1 Sep 2011, 8:41 AM
var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
var today =Ext.Date.format(dt, 'Y-m-d');
alert(today);

I tried this but it says that Ext.Date is undefined :(.
What should is do to resolve this in extjs. I am using version 3.4.0
Sorry for simple question since I am new to Extjs.

tobiu
1 Sep 2011, 9:06 AM
this is an ext 4 forum ;)

for ext 3 the link is
http://dev.sencha.com/deploy/ext-3.4.0/docs/



var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
document.write(dt.format('Y-m-d')); // 2007-01-10
document.write(dt.format('F j, Y, g:i a')); // January 10, 2007, 3:05 pm
document.write(dt.format('l, \\t\\he jS \\of F Y h:i:s A')); // Wednesday, the 10th of January 2007 03:05:01 PM

new2extjs
1 Sep 2011, 9:49 AM
It worked!!!
Thanks a lot :)
will be asking more in future ;)