View Full Version : How to set Current Date and Starting Time

13 Mar 2012, 2:51 AM
Hi all forum member

I am working with ExtJs 4 an MVC.
I want Current Date with Fixed Starting Time so how can I get??

like I have specific date and time eg. new Date(2012, 1, 7, 8)
But I want Current Date and time start from 8am like above example.
I am getting current Date Successfully but How can I set Starting time?

13 Mar 2012, 4:04 AM
var dt = new Date('1/10/2007 08:00:00 AM GMT-0600');

13 Mar 2012, 4:18 AM
Hi Chramer

thanks for response.
I know this things.But I want 8am time with Current Date.

13 Mar 2012, 4:29 AM
It's nasty, but it works..

var dt = new Date(Ext.Date.format(new Date(), 'n/j/Y') + ' 08:00:00 AM GMT-0600');

13 Mar 2012, 4:41 AM
You can also use this

var dt = new Date();
dt.setHours(8, 0, 0, 0);

13 Mar 2012, 4:47 AM
that's much better..