Jump to content

Archived

This topic is now archived and is closed to further replies.

LBPP

Truncate string to one char for small calendar display

Recommended Posts

I have a php script that shows a mini calendar on my site [url=http://www.LBPP.net/geeklog]http://www.LBPP.net/geeklog[/url], right now the days are abbreviated to 3 chars ie "Sun" because of this it is making the calendar too wide and is being cut off. I need to truncate the output of this script to just one char so its like "S" "M" "T" "W" "T" "F" "S". This is what i have:

[code] 
// Main Calendar
$BlockDisplay .= "</td></tr><tr>";

    for ($i = 0; $i < 7; $i++)
    {
        $BlockDisplay .= "<td align='center' valign='top' width='14%'
class='mycalTitle'><font size='1'><b>"
            . ucfirst(strftime("%a", $firstdaytodisplay + ($i *
_MYCAL_DAY_)))
            . "</b></font></td>";
    }
[/code]

I did not write this code and am only trying to modify it, but my PHP skills are limited. Any insight in the direction i need to take would be much appreciated.

Share this post


Link to post
Share on other sites
i know this is easy... im just stupid, can no one give me a quick solution?

Share this post


Link to post
Share on other sites
ucfirst(strftime("%a", $firstdaytodisplay + ($i *
_MYCAL_DAY_)))

Replace with:
[b]substr(ucfirst(strftime("%a", $firstdaytodisplay + ($i *
_MYCAL_DAY_))),0,1)[/b]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.