Home > Archive > PHP DB > March 2007 > Re: [PHP-DB] Values in a date field
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] Values in a date field
|
|
| tg-php@gryffyndevelopment.com 2007-03-18, 4:01 am |
| Assuming you're using MySQL, try MONTH(). As in:
SELECT MONTH(SomeDateField) FROM SomeTable
http://dev.mysql.com/doc/refman/4.1...-functions.html
If this isn't a database question, but a general PHP question, try this:
// For numeric month without leading zero, use "n"
echo date("n", strtotime($subscription_begins));
http://us3.php.net/manual/en/function.date.php
-TG
= = = Original message = = =
I have a $subscription_begins variable. It the date type. YYYY-MM-DD
How may I find out the month value (1 to 12) of this variable?
Ron
________________________________________
___________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
| |
|
| sry.. just check the script.. if able.. plz info me
----- Original Message -----
From: <tg-php@gryffyndevelopment.com>
To: <php-db@lists.php.net>
Cc: <ron.php@actsministries.org>
Sent: Sunday, March 18, 2007 8:38 AM
Subject: Re: [PHP-DB] Values in a date field
> Assuming you're using MySQL, try MONTH(). As in:
>
> SELECT MONTH(SomeDateField) FROM SomeTable
>
> http://dev.mysql.com/doc/refman/4.1...-functions.html
>
>
>
> If this isn't a database question, but a general PHP question, try this:
>
> // For numeric month without leading zero, use "n"
> echo date("n", strtotime($subscription_begins));
<?
$sql="SELECT id,date FROM SomeTable where date>2006-11-31 and 2007-1-1";
mysql($sql);
?>
the main problem is... what field u search for? are those a birthday field
or what?
my opinion was, the only reason u search like this is for birthday field.
>
> http://us3.php.net/manual/en/function.date.php
>
> -TG
>
> = = = Original message = = =
>
> I have a $subscription_begins variable. It the date type. YYYY-MM-DD
>
> How may I find out the month value (1 to 12) of this variable?
>
> Ron
>
>
> ________________________________________
___________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
|
|
|
|
|