Problems changing the date and time for blog entries
Hi there,
Im currently using the blog module to display a list of blog entries on my homepage. The problem is im trying to get the date format to the following: 10 Feb '09. Note that the apostrophe is vital.
This what I have done but isn't working:
I have mapped the textSettingsTemplate.ascx and edited the code as follows:
<
asp:Panel
ID
=
"dateTimeFormatPanel"
runat
=
"server"
>
<
asp:Label
ID
=
"lbl3"
runat
=
"server"
Text
=
"Date format"
AssociatedControlID
=
"dateTimeFieldFormat"
></
asp:Label
>
<
asp:DropDownList
ID
=
"dateTimeFieldFormat"
runat
=
"server"
>
<
asp:ListItem
Value
=
"dd MMM yy"
Text
=
"Petes Date and Time"
/>
</
asp:DropDownList
>
<
p
class
=
"example"
></
p
>
</
asp:Panel
>
Hi Peter,
Thank you for contacting Telerik Support.
Please see the attached sample code,. which can help you specify your own Format:
DateTime date = DateTime.Today;
Console.WriteLine(date.ToString(
"MMM \"'\"yy"
));
//Any text between the two escaped quotation marks (\”…\”) will be printed as literal text
<sf:FieldListView ID=
"PostDate"
runat=
"server"
Format=
" | PublicationDate.ToLocal(): dd MMM, '\''yy"
/>
Brilliant,
Boyan, I just want to thank you for giving me a decent and well thought out answer, sadly this doesn't happen too often. :) Really appreciate the effort.
Thanks again,
Peter
Hi Boyan,
I have followed all of the steps to map the control "TextSettingTemplate.ascx". Where do I make the code change for this:
DateTime date = DateTime.Today;
Console.WriteLine(date.ToString("MMM \"'\"yy"));
//Any text between the two escaped quotation marks (\”…\”) will be printed as literal text
Hi Boyan,
Any more info on this?
Thanks
Hello James,
You can set this date fromat in any of the templates (Go to Sitefinity backend ->Design->Widget Templates) that contain fields of type DateTime to achieve the same functionality.
I believe Peter was talking about a custom template in the first post.
Greetings,
Boyan Barnev
the Telerik team