I'm doing a web application for articles
Articles must be shown by month, 开发者_运维知识库with its published date stored as mm/yyyyNow:
1- Should I use a DATE type field for storing?
2- Will jQuery UI datePicker be useful for showing mm/yyyy? 3- How could I sort by mm/yyyy?I guess it will be more complicated if I store date normally and extract the day from date each time I want to do something, right?
Thanks,
I would store the published date as a DateTime value in my database and then do something different for the display. With the DatePicker's you can set the format for how the date should be presented.
$( "MyDate" ).datepicker( { altFormat: 'mm/yyyy' } );
If your articles are always Month and Year and the actual day doesn't matter, you may want to think about usability a bit. It may be better to use Drop Down Lists for the Months and Year...
精彩评论