# SELECTing rows by date as timestamp

**URL:** <https://forum.kirupa.com/t/selecting-rows-by-date-as-timestamp/268129>\
**Category:** Uncategorized\
**Created:** [August 10, 2008, 12:36pm UTC](https://forum.kirupa.com/t/selecting-rows-by-date-as-timestamp/268129 "2008-08-10T12:36:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikomax](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikomax/32/3664_2.png) [@nikomax](https://forum.kirupa.com/u/nikomax)\
**Post date:** [August 10, 2008, 12:36pm UTC](https://forum.kirupa.com/t/selecting-rows-by-date-as-timestamp/268129/1 "2008-08-10T12:36:32Z")

</div>

Hello there!

I have been using placing date in my database as timestamps in an int type column.

I would like to select posts from a table by the year and then by the month given.

For example,  
I would like to select rows inserted in the year 2007 and in January.

Now using FROM\_UNIXTIME I could order the posts by year and month but now im not too sure what to do just to get certain posts

Here is what I uesd to sort the row:

```auto
SELECT id, dateSubmit FROM news WHERE FROM_UNIXTIME(dateSubmit)='YEAR(FROM_UNIXTIME($year)

```

Any ideas?

Paul
