> further research indicates that for PG I could trysomething like:
> 
> SELECT EXTRACT(MONTH FROM TIMESTAMP)

I'm sure there is a NOW() or TIME() function in PG that returns the
current date/time. Then you could do this:

SELECT * FROM your_table WHERE EXTRACT(MONTH FROM your_column) =
EXTRACT(MONTH FROM PG_CURRENT_TIME_FUNCTION());

>  $today = getdate();
>  $start = $today['year'] . '-' . $today['mon'] . '-' . '01';
>  $end  =  $today['year'] . '-' . $today['mon'] . '-' . '31';
> 
> "SELECT * FROM guest WHERE pdate BETWEEN {$start} AND {$end}";
> 
> but PG doesn't like my format of $pdate as type date, since the result
for
> $start and $end seems to result in type integer. Sigh.

I think PG uses the unix timestamp format, the number of seconds since
Jan 1, 1970 or something. You could use a combination of date() and
mktime() and maybe even strtotime() to figure the unix timestamp of the
current month's start and end, then use the BETWEEN SQL given above...

---John Holmes...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to