terça-feira, agosto 30, 2005

Format datetime variable type

.NET Framework Developer's Guide

Custom DateTime Format Strings
You can exercise greater control over how a DateTime object is formatted by using custom DateTime format specifiers to create your own custom DateTime format string. Combine one or more custom format specifiers to construct a DateTime formatting pattern that yields the output you prefer. In fact, most of the standard DateTime format specifiers are aliases for formatting patterns specified in the currently applicable DateTimeFormatInfo Class.

My Example:

// PPI: I need to format date like this "01/12 - 12:05", but (/) was replaced
// with (-) so I invented an formula :D
dteCreditDate.ToString("dd_MM - hh:mm").Replace("_", "/")



http://msdn.microsoft.com

http://www.experts-exchange.com

Sem comentários: