Created
March 18, 2024 16:46
-
-
Save odan/34b929f87430ed5d8346d9d40e9bd790 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
// CultureInfo culture = new CultureInfo("en-US"); | |
// Full-date notation as defined by RFC 3339, section 5.6, for example, 2024-03-28 | |
string date1 = string.Format("{0:yyyy}-{0:MM}-{0:dd}", DateTime.Now); | |
Console.WriteLine(date1); | |
// RFC 3339, section 5.6, for example, 2024-03-28T17:32:28Z | |
string date2 = string.Format("{0:yyyy}-{0:MM}-{0:dd}T{0:hh}:{0:mm}:{0:ss}Z", DateTime.Now); | |
Console.WriteLine(date2); | |
// Curreny format CHF | |
NumberFormatInfo info = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone(); | |
info.NumberGroupSeparator = "'"; | |
info.NumberDecimalSeparator = "."; | |
// 2'147'483'647.00 | |
Console.WriteLine(int.MaxValue.ToString("n", info)); | |
// 123'456'789.12 | |
Console.WriteLine(123456789.12.ToString("n", info)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment