Jürgen Bayer
Jürgen Bayer

Reputation: 3023

DateSeparator and TimeSeparator missing in DateTimeFormatInfo in .NET API for Windows Store Apps

In the .NET API for Windows Store Apps DateTimeFormatInfo does not include the properties DateSeparator and TimeSeparator. The reason is possibly that both allowed setting in the full API. But in case I need to get the current date or time separator (and I do), what could I possibly use instead?

Upvotes: 3

Views: 323

Answers (1)

AndrewS
AndrewS

Reputation: 6104

You can use the DateTime format strings to get the info.

var dateSep = DateTime.Now.ToString("%/", dateTimeFormatInfo);
var timeSep = DateTime.Now.ToString("%:", dateTimeFormatInfo);

Upvotes: 8

Related Questions