I usually keep the date as timestamp in sql.

But now Im doing a project that I want that the date appears like "Wednesday, 30 April, 2014".

And Im using datepicker to format the date like I want and its working fine.

$('.datepicker').datepicker({
    dateFormat: 'DD, d MM, yy',         
});

But now I am in doubt, if it is appropriate to save date as varchar, but also dont seems possible to save "Wednesday, 30 April, 2014" as timestamp or datetime or someting else date option.

What do you think its better?

有帮助吗?

解决方案

Use DateTime or TimeStamp but do not use a VarChar.

What do you think its better?

This type of question are problematic on StackOverflow, but it has been asked before.

If you ever store it as a VARCHAR it will make your life very hard. Because doing calculation on dates will just be a real hassle.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top