CSV Reports
DateTimeFormat Property
Example 



KellermanSoftware.CsvReports Namespace > CsvWriter Class : DateTimeFormat Property
Property which controls date format. Default is "g". See https://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx
Syntax
Public Property DateTimeFormat As String
Dim instance As CsvWriter
Dim value As String
 
instance.DateTimeFormat = value
 
value = instance.DateTimeFormat
public string DateTimeFormat {get; set;}
public:
property String^ DateTimeFormat {
   String^ get();
   void set (    String^ value);
}
Example
CsvWriter csvWriter = new CsvWriter(); //Trial Mode
//CsvWriter csvWriter = new CsvWriter("place user name here", "place license key here"); //License Mode
 
// Default DateTimeFormat - "g"
 
List<Person> persons = new List<Person>();
Person person1 = new Person();
person1.FirstName = "John";
person1.LastName = "Smith";
person1.BirthDate = DateTime.Now.AddDays(-1);
persons.Add(person1);
 
Console.WriteLine("Default DateTimeFormat = g");
string result = csvWriter.ClassListToCsvString(persons);
Console.WriteLine(result);
 
Console.WriteLine();
csvWriter.DateTimeFormat = "d";
Console.WriteLine("DataTimeFormat = d");
result = csvWriter.ClassListToCsvString(persons);
Console.WriteLine(result);
Dim csvWriter As New CsvWriter() 'Trial Mode
'Dim csvWriter As New CsvWriter("place user name here", "place license key here") 'License Mode
 
' Default DateTimeFormat - "g"
 
Dim persons As New List(Of Person)()
Dim person1 As New Person()
person1.FirstName = "John"
person1.LastName = "Smith"
person1.BirthDate = Date.Now.AddDays(-1)
persons.Add(person1)
 
Console.WriteLine("Default DateTimeFormat = g")
Dim result As String = csvWriter.ClassListToCsvString(persons)
Console.WriteLine(result)
 
Console.WriteLine()
csvWriter.DateTimeFormat = "d"
Console.WriteLine("DataTimeFormat = d")
result = csvWriter.ClassListToCsvString(persons)
Console.WriteLine(result)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CsvWriter Class
CsvWriter Members