Re: Help w/Date Format from db
| From: | Jack Sasportas | Date: | Thu, 27 Jul 2000 03:06:44 +0000 |
| Subject: | Re: Help w/Date Format from db | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8465@lists.php.net to get a copy of this message | ||
Thanks for the fast response, but the result is all zeros...
I basically did this:
$tdate = explode('-', "mysql_result($result,$i,'received_date')");
$tdate = sprintf("%d-%d-%d", $tdate[1], $tdate[2], $tdate[0]);
echo $tdate;
Again I am trying to format the date in the file to basically just have
dd-mm-yy, by doing this it would be in standard format so to speak and also
take 2 characters for the year instead of 4.
Is this still the best way to do it ? or even the right way for what I'm trying
to do ?
Thanks
John Coggeshall wrote:
> You could do something as simple as
>
> $date = explode('-', "2000-04-25");
> $date = sprintf("%d-%d-%d", $date[1], $date[2], $date[0]);
>
> echo $date;
>
> That would get you "04-25-2000". Check the manual if you want more detailed
> instructions, though. (look up date(), mktime()
>
> John
>
> -----Original Message-----
> From: Jack Sasportas [mailto:jack@innovativeinternet.com]
> Sent: Wednesday, July 26, 2000 10:49 PM
> To: php
> Subject: [PHP] Help w/Date Format from db
>
> When I pull the date from a file such as
> echo mysql_result($result,$i,received_date);
>
> I don't want the standard format of 0000-00-00, Ihave searched a few
> places including php.net, but not finding what I want.
>
> I want to take the date from the database, and lets say display
> 04-01-99.
> If someone can please send the proper formatting needed to do this I
> would appreciate it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
___________________________________________________________
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net