1

I wanna format short date for some locale, but it's different between JS and .NET, can I make it the same? In JS, I use toLocaleDateString to format, and in .NET use ShortDatePattern, but it's not the same formating. Ex:

JS : locate: Italian (Switzerland) => shortDate: 27/9/2020
.NET: locate: Italian (Switzerland) => shortDate: 27.09.2020

Any ideal for it? Thank you!

A.R.SEIF
  • 865
  • 1
  • 7
  • 25
Tien Le
  • 21
  • 1

1 Answers1

0

you use this code
DateTime.Now.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture)
However, this bug is due to the operating system settings. This bug does not exist if you modify the date format.

A.R.SEIF
  • 865
  • 1
  • 7
  • 25
  • this bug not only for one locale, I use it for many locale, so I hope we have a method which the same return in JS and .NET – Tien Le Sep 27 '20 at 09:05
  • in .NET reffer to backend in one server . and JS in client use this app.so if in server date format correctly .and is ok.in every where – A.R.SEIF Sep 27 '20 at 09:10
  • answer edited.i help of [answer](https://stackoverflow.com/questions/42551949/datetime-tostring-removes-slashes) – A.R.SEIF Sep 27 '20 at 09:37