How to convert DateTime into a string in C#
Create date time 2019-11-12 22:45:12.004 DateTime date = new DateTime(2019, 11, 12, 22, 45, 12, 004); Converting to string format string date_str = date.ToString(“dd/MM/yyyy HH:mm:ss”);
Create date time 2019-11-12 22:45:12.004 DateTime date = new DateTime(2019, 11, 12, 22, 45, 12, 004); Converting to string format string date_str = date.ToString(“dd/MM/yyyy HH:mm:ss”);
The easiest way is to use String.Format() with the format specifier: double a = 0.000006; string formatted = String.Format(“{0:F6}”, a);
1. Creating a list: var list1 = new List(); 2. Adding values to the list: foreach (int value in Enumerable.Range(1, 10)) { var item = value + 100; list1.Add(item); } 3. Converting list into a string: string msg = string.Join(“,”, ohlc.ToArray());