I am updating some code that formats a date into a string using "MM / dd / yy". I need her to be culturally aware, but I want to keep a two-digit year in order to keep the date shorter. Below I came up with, but is there a better way?
string dateFormat = culture_Info.DateTimeFormat.ShortDatePattern.Replace("yyyy", "yy");
I don't know anything, no (and I pretty much considered formatting). What you have, obviously, still leaves an unpleasant taste in your mouth, but I think this is the best you can do.
As John says, I donβt think that by default you can do what you want. But the real question is: do you really need to do this? In the end, you only type a couple of bytes. Is there a "bad taste in your mouth?"
Source: https://habr.com/ru/post/906883/More articles:Javascript: push an array to an array with a for loop - javascriptSetting the SOAP Header Tag Attribute in PHP - soapIs a superclass instantiated when an object is created? - javaIs it better to use column aliases with or without the AS keyword? - syntaxMongoDB historical data memory - best practice? - databaseHow to solve flicker element when scrolling with parallax effect in JavaScript? - javascriptCombining bit flags into a PHP class constant - bit-manipulationUsing a signed Google Maps API geocoding request from a .NET command-line application - c #What is the difference between the functions () {} () and! Function () {} () - javascriptpush popup forward - javascriptAll Articles