תאריך עברי בשפת c#
הקוד לקוח מכאן:
הקוד לקוח מכאן:
קוד:
public static string GetHebrewJewishDateString(DateTime anyDate, bool addDayOfWeek)
{
//http://csharpprogramming.blogspot.co.il/2005/03/c-hebrew-date.html
System.Text.StringBuilder hebrewFormatedString = new System.Text.StringBuilder();
// Create the hebrew culture to use hebrew (Jewish) calendar
CultureInfo jewishCulture = CultureInfo.CreateSpecificCulture("he-IL");
jewishCulture.DateTimeFormat.Calendar = new HebrewCalendar();
#region Format the date into a Jewish format
if (addDayOfWeek)
{
// Day of the week in the format " "
hebrewFormatedString.Append(anyDate.ToString("dddd", jewishCulture) + " ");
}
// Day of the month in the format "'"
hebrewFormatedString.Append(anyDate.ToString("dd", jewishCulture) + " ");
// Month and year in the format " "
hebrewFormatedString.Append("" + anyDate.ToString("y", jewishCulture));
#endregion
return hebrewFormatedString.ToString();
אין תגובות:
הוסף רשומת תגובה