Convert UTC datetime in ASP.NET MVC using Jquery -


i have utc date 1 of properties of asp.net mvc model. want convert in local time display.

i wrote conversion logic in c#, bit code run on server, take local time on server. hence, have convert in local time on client side i.e. javascript.

this html

<label id="uploadedon">@item.publicationdate.tostring("mmmm dd, yyyy,hh:mm: tt")</label> 

how can convert date local datetime using javascript..

you can create static method in utility class takes culture parameter.

invoke method fetch culture specific date

public static string formatdate(string culture)     {         string returndate = string.empty;          if (culture == "en-us")         {             //format accordingly          }         else if (culture == "en-in")         {             //format accordingly          }          return returndate;     } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -