Printing date out of array

Printing date out of array

am 01.09.2008 01:44:47 von mikesd

This is my date array:

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



This is my date select in the form:


echo '';

echo '';


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?


--
Michael S. Dunsavage


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

Re: Printing date out of array

am 01.09.2008 01:52:18 von olafurw

I would suggest the time() value to be saved in your database. Since
the date() function can use that as the second parameter and you can
use any format date() allows. Or make your own.

=D3lafur Waage
olafurw@gmail.com

2008/8/31 Michael S. Dunsavage :
> This is my date array:
>
> $months =3D array (1 =3D> 'January', 'February', 'March', 'April', 'May',
> 'June', 'July', 'August', 'September', 'October', 'November',
> 'December');
>
>
>
> This is my date select in the form:
>
>
> echo '';
>
> echo '';
>
>
> 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?
>
>
> --
> Michael S. Dunsavage
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Re: Printing date out of array

am 01.09.2008 02:42:23 von Jochem Maas

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 '';
>
> echo '';
>
>
> 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