Hebrew / Jewish Date Conversion

I would like to convert Gregorian dates (the ones we usually use in America) to Hebrew (Jewish) dates. I am using Adobe Flash CS5 for an Adobe AIR application. Is there any code for this already developed in ActionScript 3.0?

After some time study, I found that Windows applications built on Visual Studio have built-in functions for such needs. Is there a way to call a function in the form of a window or something from AIR?

Best, Lucas

+5
source share
2 answers

Unfortunately, after searching, I can not find any library or anything else to get the Hebrew date in flash. However, I found this site:

http://www.hebcal.com/converter/?gd=21&gm=6&gy=2011&g2h=Convert+Gregorian+to+Hebrew+date

, hebcal.com gregorian date GET URL- . , Flash URLLoader URL-, gregorian -, HTML , .

, , - hebcal.com. ActionScript 3 :

import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;

var currentDate:Date = new Date();

var dateLoader:URLLoader = new URLLoader();

var dateQueryURL:String = 'http://www.hebcal.com/converter/?gd=' + currentDate.date + '&gm=' + (currentDate.month+1)  + '&gy=' + currentDate.fullYear + '&g2h=Convert+Gregorian+to+Hebrew+date';

trace(dateQueryURL);

dateLoader.addEventListener(Event.COMPLETE, onDateConverted);

dateLoader.load(new URLRequest(dateQueryURL));

var hebrewDateSearchRegexp:RegExp = /([a-zA-Z0-9 ,]{1,30})(?=<\/b)/gixm;

function onDateConverted(e:Event):void
{
    var queryResult:String = e.currentTarget.data as String;
    var hebrewDate:String;
    var dateArr:Array = queryResult.match(hebrewDateSearchRegexp);

    if(dateArr && dateArr.length > 0){
        //The date was found in the string
        hebrewDate = dateArr[0];
        trace("The current Hebrew date is: " + hebrewDate);
    }else{
        trace("Error retrieving current Hebrew date.");
    }
}

, / HTML, . string.match() .

, currentDate.month 1, flash 0-11, hebcal.com 1 12.

+5

adobe, # ( ), # ex. , :

/// <summary>
/// Converts a gregorian date to its hebrew date string representation,
/// using custom DateTime format string.
/// </summary>
/// <param name="value">The <see cref="DateTime"/> value to convert.</param>
/// <param name="format">A standard or custom date-time format string.</param>
public static string ToJewishDateString(this DateTime value, string format)
{
  var ci = CultureInfo.CreateSpecificCulture("he-IL");
  ci.DateTimeFormat.Calendar = new HebrewCalendar();      
  return value.ToString(format, ci);
}
+1

All Articles