Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Formatting date in SAP system
You will need to apply new culture to the existing thread as shown below:
Example
DateTime now = DateTime.Now;
Console.WriteLine(now);
CultureInfo sapCulture = new CultureInfo("en-US", true);
sapCulture.DateTimeFormat.ShortDatePattern = "ddMMyyyy";
//sapCulture.DateTimeFormat.FullDateTimePattern =
sapCulture.DateTimeFormat.ShortDatePattern + " HH-mm-ss";
sapCulture.DateTimeFormat.LongTimePattern = "HH-mm-ss";
//sapCulture.DateTimeFormat.ShortTimePattern = "HH-mm-ss";
System.Threading.Thread.CurrentThread.CurrentCulture = sapCulture;
//System.Threading.Thread.CurrentThread.CurrentUICulture = sapCulture;
Console.WriteLine(now); Advertisements
