By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,275 Members | 2,008 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,275 IT Pros & Developers. It's quick & easy.

convert hebrew calander date to grugorian calander date

P: 1
i need to convert date of hebrew calander to grugorian;
how can i do it?

irena.
3 Weeks Ago #1
Share this Question
Share on Google+
2 Replies


P: 72
Why not use an API like this: Hebrew Date Converter REST API
3 Weeks Ago #2

P: 94
Convert using HebrewCalendar and GregorianCalendar.
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.IO;
  3. using System.Globalization;
  4.  
  5. private string SetHebrewDate(int yyyy, int mm, int dd)
  6. {
  7.             CultureInfo culture1 = new CultureInfo("he-IL", true);
  8.             Calendar HebrewCalendar = new HebrewCalendar();
  9.  
  10.             DateTime dt1;
  11.             // set Hebrew date
  12.             dt1 = HebrewCalendar.ToDateTime(yyyy, mm, dd, 0, 0, 0, 0, Calendar.CurrentEra);
  13.  
  14.             GregorianCalendar myGre = new GregorianCalendar();
  15.             CultureInfo culture2 = new CultureInfo("en-GB", true);
  16.             string y2 = myGre.GetYear(dt1).ToString("D4",culture2);
  17.             string m2 = myGre.GetMonth(dt1).ToString("D2",culture2);
  18.             string d2 = myGre.GetDayOfMonth(dt1).ToString("D2",culture2);
  19.             Return d2 + "/" + m2 + "/" + y2;
  20. }
  21.  
3 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.