Widget {date} option
-
I want to use only the month or day and not the entire {date} in my widget for the calendar. Can anyone please help me out?
-
Use {date format=”M, d”} (or your choice of date formatting) to customize the date. All date template tags can take custom formatting.
Thank for that. But when I use the code like
<span> {date format=”F”} </span> for month
<span> {date format=”d”} </span> for daythe month appears correctly but my date gets messed up and {date format =”d”} is printed on the screen
How are you using the code? Can you provide an exact sample from your template?
My code in the widget is as foolows:
<div id="events"> <div class="item"> <span class="month">{date format="F"}</span> <div class="event-date"> <span class ="day">{date}</span></div> <h4>{link_title}</h4> <p class="time">From {time} until:{endusertime},{category}</p> </div> </div>[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
In the second {date} in the above code the display gets messed up and does not get parsed. I want to display the month in one line and the day in the other.
<div id="events"> <div class="item"> <span class="month">{date format="F"}</span> <div class="event-date"> <span class ="day">{date}</span></div> <h4>{link_title}</h4> <p class="time">From {time} until:{endusertime},{category}</p> </div> </div>this was my code for implementation
Interesting. Each template item is only parsed once. However, there are multiple date template options – I recommend using {dtstart format=”F”} and {date}, respectively.
For the record, {date} only includes the base date information; {dtstart} contains a full timestamp including the date and time information.
It worked thank you my widget looks the way I wanted it to.
The topic ‘Widget {date} option’ is closed to new replies.