Is it possible to add the word "at" between a Date and Time format? I tried to add it just like this "dddd, d MMM, yyyy at HH:mm" but the webapp is tranforming it into "aA" or "aP" depending of regional configuration CA or AU
Console.WriteLine(DateTime.Now.ToString("dddd, d MMM, yyyy at HH:mm"));
I forgot to say. I must be as a format string and no complex or concat functions.
A date and time format string defines the text representation of a DateTime or DateTimeOffset value that results from a formatting operation. It can also define the representation of a date and time value that is required in a parsing operation in order to successfully convert the string to a date and time.
We can convert a string to datetime using strptime() function. This function is available in datetime and time modules to parse a string to datetime and time objects respectively.
In C#, a verbatim string is created using a special symbol @. @ is known as a verbatim identifier. If a string contains @ as a prefix followed by double quotes, then compiler identifies that string as a verbatim string and compile that string.
Yes, you need to escape the word by putting it in '
marks dddd, d MMM, yyyy 'at' HH:mm
Custom DateTime string formatting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With