Vivid Lust Posted February 14, 2010 Share Posted February 14, 2010 Hi, With a list of timestamps, e.g: 2010-02-03 07:17:43 2010-02-08 13:43:51 2010-02-09 04:21:25 Is it possible to find the distinct months? Quote Link to comment https://forums.phpfreaks.com/topic/192039-distinct-months-from-timestamps/ Share on other sites More sharing options...
jl5501 Posted February 14, 2010 Share Posted February 14, 2010 The easist way to go about this, is simply to store the month as a separate column, then you do not have to worry about processing your date/time fields Quote Link to comment https://forums.phpfreaks.com/topic/192039-distinct-months-from-timestamps/#findComment-1012129 Share on other sites More sharing options...
PFMaBiSmAd Posted February 14, 2010 Share Posted February 14, 2010 Just use the mysql MONTH() function to get the month number from your existing values. Storing the month separately results in redundant data and breaks the normalization of your table (i.e. if you update any of the dates, you must also waste processing time regenerating the month value.) Quote Link to comment https://forums.phpfreaks.com/topic/192039-distinct-months-from-timestamps/#findComment-1012150 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.