467,877 Members | 1,085 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,877 developers. It's quick & easy.

convert hebrew calander date to grugorian calander date

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

irena.
Feb 1 '20 #1
  • viewed: 1760
Share:
2 Replies
cactusdata
Expert 128KB
Why not use an API like this: Hebrew Date Converter REST API
Feb 2 '20 #2
128KB
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.  
Feb 3 '20 #3

Post your reply

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

Similar topics

7 posts views Thread by Nimmy | last post: by
1 post views Thread by Sam | last post: by
10 posts views Thread by satishrajana | last post: by
5 posts views Thread by Artie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.