Values in a date field

Values in a date field

am 17.03.2007 14:44:43 von Ron Piggott

--=-uWcqZDHz4zzbnO28tke+
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


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


--=-uWcqZDHz4zzbnO28tke+--

´ð¸´: [PHP-DB] Values in a date field

am 17.03.2007 15:11:19 von jacob

$date=3DGetdate($subsciption_begins);
$month=3D$date[mon]
-----ÓʼþÔ­¼þ-----
·¢¼þÈË: Ron Piggott [mailto:ron.php@actsministries.org]=20
·¢ËÍʱ¼ä: 2007Äê3ÔÂ17ÈÕ 21:45
ÊÕ¼þÈË: PHP DB
Ö÷Ìâ: [PHP-DB] Values in a date field


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

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

RE: Values in a date field

am 17.03.2007 15:35:31 von Bastien Koert

select date_format(datefield,'%M') as theDate from table [where clause]

Bastien




>From: Ron Piggott
>Reply-To: ron.php@actsministries.org
>To: PHP DB
>Subject: [PHP-DB] Values in a date field
>Date: Sat, 17 Mar 2007 09:44:43 -0400
>
>
>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
>

____________________________________________________________ _____
Don’t waste time standing in line—try shopping online. Visit Sympatico / MSN
Shopping today! http://shopping.sympatico.msn.ca

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

Re: Values in a date field

am 18.03.2007 02:38:40 von Trevor Gryffyn

Assuming you're using MySQL, try MONTH(). As in:

SELECT MONTH(SomeDateField) FROM SomeTable

http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functio ns.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.

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

Re: Values in a date field

am 20.03.2007 02:48:24 von bedul

sry.. just check the script.. if able.. plz info me
----- Original Message -----
From:
To:
Cc:
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/en/date-and-time-functio ns.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
>

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