[wp-hackers] question on mysql2date
Mark Shields
laebshade at gmail.com
Sat Oct 2 15:47:22 UTC 2004
Use strlen($m) == 6) in an if statement to detect a month/year date
(200410), then just format that date.
On Sat, 2 Oct 2004 11:29:49 -0400, David Clark <david at davidsaccess.com> wrote:
> Hi,
>
> I have a function to display the human readable version of $m, which is
> the heading of a directory listing. The code is:
> function archive_header_mo($month, $before='', $after='') {
> global $lmonth, $post, $m;
> if ($month != $lmonth)
> { $output = mysql2date("F",$post->post_date);
> if ('' != mysql2date("d",$m))
> {$output .= mysql2date("d",$m);}
> $output .= ', '.mysql2date("Y",$post->post_date);
> $output .= '<a
> href="'.get_month_link(mysql2date("Y",$post->post_date),
> mysql2date("m",$post->post_date)) .'">+</a>';
> $output = $before.$output.$after.NL;
> $lmonth = $month;
> }
> echo $output;
> }
>
> The problem I am having is that when $m does not have a day, as in
> 200404, it returns "April31, 2004" and not the "April, 2004" I want and
> expect.
>
> I know I am missing something basic, just don't know what it is
>
> thanks,
>
> dc
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>
--
- Mark Shields
More information about the hackers
mailing list