View Full Version : convert Unix time in a store

25 Sep 2010, 8:58 AM

{name:'contact', type: 'date', dateFormat: 'timestamp',
convert: function(v) {
var d = new Date(v*1000);
return d.format('D j M Y, H:i:s');} }]

Why I need to convert my unix timestamp to milliseconds to allow the convert function working ?
Is there a way to convert directly the unix timestamp into a user friendly format ?

25 Sep 2010, 6:41 PM
You have to pass Date() milliseconds. That's just the way they have JS

25 Sep 2010, 10:00 PM
fabads, you are confused.

Your field should store a Date object

The concept of "user friendly" doesn't exist. It is a Date. The "dateFormat" config specifies the format it arrives in, so you do not need a converter.