Thursday, February 18, 2010

setting value to a RadDatePicker on load

I had to come with a page who has a link and returns to the selected values of a list . So here is the way i did it.


private void SetDateRequest(string dateValue, RadDatePicker datePicker, DateTime valueDate)
{
DateTime dateOut;
datePicker.SelectedDate = valueDate;
if (DateTime.TryParseExact(dateValue, "yyyy-MM-dd", null, DateTimeStyles.None, out dateOut))
{
datePicker.SelectedDate = dateOut;
}
}

and this is how I call it :

SetDateRequest(dateTo, ToDateRadDatePicker, endDate);


Cheers,

Tuesday, February 16, 2010

Error on TortoiseSVN installing on Windows 7

I made the upgrade to windows 7 enterprise edition this past weekend. But happen that when trying to install tortoise ver 1.6.7 the context menu did not show up. So I google around and found the answer:

Install the 32bit version of tortoise SVN parallel the 64bit version.
TC is a 32bit program and the 64bit shell extension can't be used by [u]any[/u] 32bit program.


this solved my problem to be able to export the projects from the code repository I was in urge for.

Cheers,

Tuesday, February 2, 2010

DateTime.ToString() display “A.M.” or “P.M.”


Is there any way to use the DateTime.ToString() method to display the meridiem of the time portion as "A.M." instead of "AM"?


here is the work around.

using System;
using System.Globalization;

class Program {
public static void Main() {
CultureInfo c = (CultureInfo)CultureInfo.CurrentCulture.Clone();
c.DateTimeFormat.AMDesignator = "A.M.";
c.DateTimeFormat.PMDesignator = "P.M.";
Console.WriteLine(DateTime.Now.ToString("tt",c));
}
}

This are a second way to try with a designator. But here you have a static date format and therefore miss the culture.


DateTime time = DateTime.Now;
string s = time.ToString("yyyy.MM.dd hh:mm:ss t.\\M.");
Console.WriteLine(s);



Cheers