Reputation: 37
I am getting the date from my store...
while display it, its like this..
Fri Aug 12 2011 08:56:18 GMT+0530 (IST)
but i want to display like
12 Aug 2011
In my store i kept as the type as date.
Ext.regModel('allVisit', {
fields: [
{ name: 'visitDate', type: 'date'},
{ name: 'visitId', type: 'string'},
{ name: 'visitDetailId', type: 'string'},
]
});
Thanks in advance!
Upvotes: 0
Views: 11269
Reputation: 80
Easiest way is to specify the format in your output template e.g:
<div class="Dates">
Test Date:
{TestDate:date('l, F d, Y g:i:s A')} <br />
{TestDate:date('d/m/Y H:i')}
</div>
Upvotes: 4
Reputation: 834
You have to declare the date patterns in the beginning of the main javascript file such as
Date.patterns = {
ISO8601Long : "Y-m-d H:i:s",
ISO8601Short : "Y-m-d",
ShortDate : "n/j/Y",
LongDate : "l, F d, Y",
FullDateTime : "l, F d, Y g:i:s A",
MonthDay : "F d",
ShortTime : "g:i A",
LongTime : "g:i:s A",
SortableDateTime : "Y-m-d\\TH:i:s",
UniversalSortableDateTime : "Y-m-d H:i:sO",
YearMonth : "F, Y"
};
Then you can apply these patterns according to your need as follows
Eg:
yourDate.format(Date.patterns.ISO8601Short);
yourDate.format(Date.patterns.ShortTime);
yourDate.format(Date.patterns.SortableDateTime);
Hope it will help....
Upvotes: 0
Reputation:
try to use dateFormat (dateFormat: 'g:i a') in your model :
Ext.regModel('allVisit', {
fields: [
{ name: 'visitDate', type: 'date' dateFormat: 'g:i a' },
{ name: 'visitId', type: 'string'},
{ name: 'visitDetailId', type: 'string'},
]
});
You can get help from this doc
Upvotes: 1
Reputation: 3846
Can you provide the code where you are trying to display the Date? You'll most likely have to provide the format you want there.
Upvotes: 0