Re: Printing date out of array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael S. Dunsavage schreef:
This is my date array:

$months = array (1 => 'January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October', 'November',
'December');

you want, if you ask me, to get you head round the following functions.

http://php.net/set_locale
http://php.net/time
http://php.net/date
http://php.net/mktime

more generally, check out this section of the manual (and let it
be known, dates are tricky buggers ... they can bite):

http://php.net/manual/en/book.datetime.php

additionally, check out the UNIX_TIMESTAMP() function in MySQL, which
will give you a unix timestamp (of all things!) that you can use to
generate formatted date strings easily in php using date()


This is my date select in the form:


echo '<select name="day">';
for ($day = 1; $day <= 31; $day++) {
	echo "<option value=\"$day\">$day</option>\n";
}
echo '</select>';

echo '<select name="year">';
$year = 2008;
while ($year <= 2020) {
	echo "<option value=\"$year\">$year</option>\n";
	$year++;
}
echo '</select>';


This is how it submits to mysql:




Now, when I submit it to mysql, it's all in mm-dd-yyyy format.

When I submit it to an e-mail, I'd like it to me Month-dd-yyyy. How
could I do this?

Would it be easier to pull the date from mysql and break it down
somehow? And if so how would I do that?




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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux