Closed STARSCrazy closed 5 years ago
In order to enforce certain date or time separators, the slash is not a character which must be escaped. It is a literal to surround with '
marks like so:
var smartResult = Smart.Format("It is now {Date:yyyy'/'MM'/'dd HH:mm:ss}", DateTime.Now));
var stringFmtResult = $"It is now {DateTime.Now.Date:yyyy'/'MM'/'dd HH:mm:ss}";
This is the same for string.Format
and Smart.Format
alike.
Thank you very much, this will help me 👍
Hello everybody
I have a problem with formatting date values when the delimiter is forced to use "/" or rather "\/". With string.Format this is possible:
string.Format( "{0:yyyy\\/MM\\/dd HH:mm:ss}", DateTime.Now ) //Result: 2019/05/09 10:58:47
Important: My CurrentUICulture and CurrentCulture are set to "de-DE". The default date delimiter in German is ".".
My SmartFormat.NET version: 2.4.2
Here are two examples: This works
This does not work