-1

I need to get distinct persian month from the timestamp field in mysql table. this is my query:

select distinct month(startTime) from times where subset_id='$subset_id' ORDER BY `id` DESC

but it returns a distinct Gregorian year and I can`t use it... how can I solve this?

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
Mohsen Moradi
  • 21
  • 1
  • 3

1 Answers1

-1

in case of timestamp you will get month from this line

DATE_FORMAT(FROM_UNIXTIME(startTime), '%m') 

finally your query is

select 
    distinct DATE_FORMAT(FROM_UNIXTIME(startTime), '%m')
from times where subset_id='$subset_id' ORDER BY `id` DESC