PDA

View Full Version : how daylight saving datime works ?



raminbp
26 May 2013, 10:19 PM
Hi

i want to know exact machanism of daylight saving time , and the way Extjs handles it .
i already searched and implemented what i've found about the matter. but im really confused now . about 2 weeks ago i had a problem on 16 and 17 march . now the problem doesn't exit on that particular point and shifted to 16 sep. when you add a day to 16 march the result is not 17 march , instead it returns 16 march 23:00:00.
and now the same problem happens in 16 september . why is that ?

dawesi
28 May 2013, 2:22 AM
What timezone are you talking about? Difference countries have different daylight saving dates.

Can you also provide your code sample, thanks.

friend
28 May 2013, 4:22 AM
If you problem is related to the display of date/times in a grid column:

Your Model must declare a dateFormat for the target field, where this example assumes that your incoming date/time is in an ISO-8601 format (something like, "2013-05-28 22:26:34"):



Ext.define('YourApp.model.Person', {
extend: 'Ext.data.Model',
fields: [
{name: 'userName', type: 'string'},
{name: 'userId', type: 'int', useNull: true},
{name: 'hireDate', type: 'date', dateFormat: 'c'}
]
});


The grid column renderer can then be anything you like:


{header: 'Hire Date', dataIndex: 'hireDate', sortable: true, width: 80, renderer: Ext.util.Format.dateRenderer('m/d/Y h:i:s a')}