グレゴリオ暦から日付(日、月、年)を転送するMatlabコードはありますか
ヒジュラ暦(イスラム暦)へ、またヒジュラ暦からグレゴリオ暦へ、
グレゴリオ暦の日付を変更したいとします。
2011年11月18日金曜日
金曜日22/12/1432であるイスラム暦の日付に
ありがとう
グレゴリオ暦から日付(日、月、年)を転送するMatlabコードはありますか
ヒジュラ暦(イスラム暦)へ、またヒジュラ暦からグレゴリオ暦へ、
グレゴリオ暦の日付を変更したいとします。
2011年11月18日金曜日
金曜日22/12/1432であるイスラム暦の日付に
ありがとう
Windows を使用している場合は、MATLAB 内から . NET Frameworkを使用できます。
グレゴリオ暦の日付をイスラム暦に変換する関数を次に示します( CodeProjectの記事に基づく)。
function out = GregToHijri(str, frmtIn, frmtOut)
% English (US) and Arabic (Saudi Arabia) cultures
enCult = System.Globalization.CultureInfo('en-US',false);
enCult.DateTimeFormat.Calendar = System.Globalization.GregorianCalendar();
arCult = System.Globalization.CultureInfo('ar-SA',false);
arCult.DateTimeFormat.Calendar = System.Globalization.HijriCalendar();
% parse using supplied input format
dt = System.DateTime.ParseExact(str, frmtIn, enCult.DateTimeFormat);
% convert datetime as formatted string
out = char( dt.ToString(frmtOut, arCult.DateTimeFormat) );
end
あなたの入力でテストされました:
>> GregToHijri('Friday, 18/11/2011', 'dddd, dd/MM/yyyy', 'dd/MM/yyyy')
ans =
22/12/1432