Language dates

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 năm cách đây
Hello everyone
how can I change the language and format of the dates in the control panel?
Thanks so much
9 năm cách đây
Hi,

You must change directly the view \Administration\Views\Shared\_AdminLayout.cshtml.

There is a DIV with class status-bar. The date is displayed inside it.

<div class="status-bar">
  @(EngineContext.Current.Resolve<Nop.Services.Helpers.IDateTimeHelper>().ConvertToUserTime(DateTime.Now).ToString("f"))
</div>


You can change this code by your taste. For reference you can use this.
9 năm cách đây
Hi
I want change the language of the dates in the control panel
Thanks
9 năm cách đây
svipla wrote:
Hi
I want change the language of the dates in the control panel
Thanks


Hello,

You can replace the whole div with this code:

<div class="status-bar">
  @{
    var format = "f";
    var input = EngineContext.Current.Resolve<Nop.Services.Helpers.IDateTimeHelper>().ConvertToUserTime(DateTime.Now).ToString(format);

    var dt = DateTime.ParseExact(input, format, new System.Globalization.CultureInfo("en-US"));

    var result = dt.ToString(format, new System.Globalization.CultureInfo("bg-BG"));
    
    @result
  }
</div>


Just replace the bg-BG string with your culture and everything will work.

For full list of possible cultures see this.
9 năm cách đây
don't work
9 năm cách đây
Hi,

Actually, I have tested the code with Italian culture:

<div class="status-bar">
  @{
    const string format = "f";
    var input = EngineContext.Current.Resolve<Nop.Services.Helpers.IDateTimeHelper>().ConvertToUserTime(DateTime.Now).ToString(format);

    var dt = DateTime.ParseExact(input, format, new System.Globalization.CultureInfo("en-US"));

    var result = dt.ToString(format, new System.Globalization.CultureInfo("it-IT"));

    @result
  }
</div>


and I got this result.
9 năm cách đây
Hi
I want to change the format and language of the calendar that appears on click in a textbox
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.