In the article called "Getting BlogEngine.NET To Work With The Local Time Zones" I described how to convert the times of the posts to the local time zones of users relying solely on JavaScript. However I got a complaint that if JavaScript is disabled for some reasons, then no date and time are displayed.

It can be fixed, I’ll explain how, but in this case – if JavaScript is disabled, the time will be in GMT, so just put the following code to PostView.ascx that basically outputs the time in GMT and if JavaScript is enabled it replaces a GMT time with a local time.


<span id="postDate_<%=Post.Id %>" class="pubDate"> on
    <%=Post.DateCreated.ToLongDateString() + " " + Post.DateCreated.ToShortTimeString() %> GMT
<script type="text/javascript">
    $("postDate_<%=Post.Id %>").firstChild.nodeValue = "on " + ConvertToLocalDate('<%=Post.DateCreated.ToLongDateString() + " " + Post.DateCreated.ToShortTimeString() %>');