Developer forum

Forum » CMS - Standard features » Format date
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Guys,

I am trying to format a date in a multi linguag website and I am uisng the same template.

I have tried using the old HTML Date extensions (http://templates.dynamicweb.com/TemplateTags/Dynamicweb-template-tags/General-tags/Date/time-tag-extensions.aspx) in razor but they don't seem to work or I am not using them properly.

Any other suggestions?

Thanks,

Adrian


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

In razor templates you don't need those extensions, because you can use the DateTime formatting available in the .NET framework.

Standard Date and Time Format Strings
Custom Date and Time Format Strings

Example:

<p>@GetDate("DwPageUpdatedDate").ToShortDateString();</p>
<p>@GetDate("DwPageUpdatedDate").ToString("s");</p>

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Thank you Morten,

That is the path I went on already but I had a dillema about the formatting when it comes to Japan.

The default way of rendering the short date and time for Japan, does not include the time format AM/PM while for other cultures it is included.

The customer requested that it should be included for Japan as well and I hoped that the default DW implementation would solve that :)

I will probably find another way of solving it using standard .NET methods.

Thank you,

Adrian

 

You must be logged in to post in the forum