object valueToConvert = "06.12.2008 13:45:17" //finnish independance day ; )
string strTime = System.Convert.ToString ( valueToConvert ).Trim ();
System.Diagnostics.Debug.WriteIf ( "The time string is " + strTime );
//Take into consideration the culture
CultureInfo culture = CultureInfo.CreateSpecificCulture ( "fi-FI" );
DateTime dtDate = DateTime.Parse ( strTime , culture );
System.Diagnostics.Debug.WriteIf ( "My dtDate.ToLongTimeString() is " + dtDate.ToLongTimeString () );
//Get the new vormat
valueToConvert = dtDate.ToLongTimeString() ;
System.Diagnostics.Debug.WriteIf ( "The datetime time " + dtDate.ToLongTimeString ());
//FOR SHORT DATE FORMAT
string strTime = System.Convert.ToString ( valueToConvert ).Trim();
System.Diagnostics.Debug.WriteIf ( "The time string is " + strTime );
//Old Data Format
CultureInfo culture = CultureInfo.CreateSpecificCulture("fi-FI");
DateTime dtDate = DateTime.Parse ( strTime , culture );
System.Diagnostics.Debug.WriteIf ( "My dtDate.ToString() is " + dtDate.ToShortDateString () );
//New Data Format
valueToConvert = dtDate.ToShortDateString () ;
System.Diagnostics.Debug.WriteIf ( "The smalldate time is dd.mm.yyyy" + dtDate.ToString ( "dd.mm.yyyy" ) );
Getting the Current TabItem when the Tab is not selected in WPF
-
[image: Banner]
This is a quick reminder to self on how to retrieve a TabItem from a WPF
TabControl *when the tab is not currently selected* because I ru...
1 month ago
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!