祈祷时间项目 [英] Prayer times project

查看:80
本文介绍了祈祷时间项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过闪光(更好)来简化祈祷时间的计划或代码,否则明智之举
使用c#...
//////////////////
例如以基本形式显示一天中所有的祷告时间(一天中有5个不同的时间):
Fajr:上午04:45
杜尔:下午12:10
阿西尔:03:30 pm
Magrib:下午06:00
埃莎:下午08:15
此任务总是在第二天更新.
(我们拥有一年362天的数据库或表格).
.
.
.
.
谢谢...

i want some idea or code for simple project of prayer time by using flash (better),other wise
using c#...
///////////////////
for example in the basic form show me the all prayer times in the day (we have 5 different time in a day):
Fajr : 04:45 am
Dhur : 12:10 pm
Asir : 03:30 pm
Magrib: 06:00 pm
Eisha : 08:15 pm
this task always updating for the next day.
(we have a database or a table for 362 days in the year).
.
.
.
.
Thanks...

推荐答案

您应该是所在位置的经度和纬度,并且还应该具有计算祈祷时间的功能!

尝试使用以下良好的代码来计算祈祷时间:)
MorningPrayer-> Fajr
日出->
MiddayPrayer-> Dhur,Asir
日落->
SunsetPrayer-> Magish,Eisha
You should have been a latitude and longitude of your location and also a function that compute prayer times!

try the following good code for compute prayer times:)
MorningPrayer->Fajr
Sunrise->
MiddayPrayer->Dhur,Asir
Sunset->
SunsetPrayer->Magrib,Eisha
struct Values
{
    public double Val0, Val1;
}
TimeSpan MorningPrayer(byte Month, byte Day, double Longitude, double Latitude)
{
    Values ep = sun(Month, Day, 4, Longitude);
    double zr = ep.Val0,
        delta = ep.Val1,
        ha = loc2hor(108.0, delta, Latitude),
        t = Round(zr - ha, 24);
    ep = sun(Month, Day, t, Longitude);
    zr = ep.Val0;
    delta = ep.Val1;
    ha = loc2hor(108.0, delta, Latitude);
    t = Round(zr - ha, 24);
    return TimeSpan.Parse(hms(t));
}
TimeSpan Sunrise(byte Month, byte Day, double Longitude, double Latitude)
{
    Values ep = sun(Month, Day, 6, Longitude);
    double zr = ep.Val0,
    delta = ep.Val1,
    ha = loc2hor(90.833, delta, Latitude),
    t = Round(zr - ha, 24);
    ep = sun(Month, Day, t, Longitude);
    zr = ep.Val0;
    delta = ep.Val1;
    ha = loc2hor(90.833, delta, Latitude);
    t = Round(zr - ha, 24);
    return TimeSpan.Parse(hms(t));
}
TimeSpan MiddayPrayer(byte Month, byte Day, double Longitude)
{
    Values ep = sun(Month, Day, 12, Longitude);
    ep = sun(Month, Day, ep.Val0, Longitude);
    double zr = ep.Val0;
    return TimeSpan.Parse(hms(zr));
}
TimeSpan Sunset(byte Month, byte Day, double Longitude, double Latitude)
{
    Values ep = sun(Month, Day, 18, Longitude);
    double zr = ep.Val0,
    delta = ep.Val1,
    ha = loc2hor(90.833, delta, Latitude),
    t = Round(zr + ha, 24);
    ep = sun(Month, Day, t, Longitude);
    zr = ep.Val0;
    delta = ep.Val1;
    ha = loc2hor(90.833, delta, Latitude);
    t = Round(zr + ha, 24);
    return TimeSpan.Parse(hms(t));
}
TimeSpan SunsetPrayer(byte Month, byte Day, double Longitude, double Latitude)
{
    Values ep = sun(Month, Day, 18.5, Longitude);
    double zr = ep.Val0,
    delta = ep.Val1,
    ha = loc2hor(94.3, delta, Latitude),
    t = Round(zr + ha, 24);
    ep = sun(Month, Day, t, Longitude);
    zr = ep.Val0;
    delta = ep.Val1;
    ha = loc2hor(94.3, delta, Latitude);
    t = Round(zr + ha, 24);
    return TimeSpan.Parse(hms(t));
}

Values sun(byte m, double d, double h, double lg)
{
    if (m < 7)
        d = 31 * (m - 1) + d + h / 24;
    else
        d = 6 + 30 * (m - 1) + d + h / 24;
    double M = 74.2023 + 0.98560026 * d,
        L = -2.75043 + 0.98564735 * d,
        lst = 8.3162159 + 0.065709824 * Math.Floor(d) + 1.00273791 * 24 * (d % 1) + lg / 15,
        e = 0.0167065,
        omega = 4.85131 - 0.052954 * d,
        ep = 23.4384717 + 0.00256 * cosd(omega),
        ed = 180.0 / Math.PI * e, u = M;
    for (byte i = 1; i < 5; i++)
        u = u - (u - ed * sind(u) - M) / (1 - e * cosd(u));
    double v = 2 * atand(tand(u / 2) * Math.Sqrt((1 + e) / (1 - e))),
        theta = L + v - M - 0.00569 - 0.00479 * sind(omega),
        delta = asind(sind(ep) * sind(theta)),
        alpha = 180.0 / Math.PI * Math.Atan2(cosd(ep) * sind(theta), cosd(theta));
    if (alpha >= 360)
        alpha -= 360;
    double ha = lst - alpha / 15;
    double zr = Round(h - ha, 24);
    Values vlu;
    vlu.Val1 = delta;
    vlu.Val0 = zr;
    return vlu;
}
double sind(double x) { return Math.Sin(Math.PI / 180.0 * x); }
double cosd(double x) { return Math.Cos(Math.PI / 180.0 * x); }
double tand(double x) { return Math.Tan(Math.PI / 180.0 * x); }
double atand(double x) { return Math.Atan(x) * 180.0 / Math.PI; }
double asind(double x) { return Math.Asin(x) * 180.0 / Math.PI; }
double acosd(double x) { return Math.Acos(x) * 180.0 / Math.PI; }
double loc2hor(double z, double d, double p) { return acosd((cosd(z) - sind(d) * sind(p)) / cosd(d) / cosd(p)) / 15; }
double Round(double x, byte a)
{
    double tmp = x % a;
    if (tmp < 0)
        tmp += a;
    return tmp;
}
string hms(double x)
{
    x = Math.Floor(3600 * x);
    double
    h = Math.Floor(x / 3600),
    mp = x - 3600 * h,
    m = Math.Floor(mp / 60),
    s = Math.Floor(mp - 60 * m);
    return h.ToString() + ":" + m.ToString() + ":" + s.ToString();
}



注意:月和日的分隔符是PersianCalendar,用于转换为它:



Note: Month and Day paramiters are PersianCalendar, for converting to it:

DateTime gregorian = new DateTime(Year, Month, Day);
System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar();
            Month = (byte)pc.GetMonth(gregorian);
            Day = (byte)pc.GetDayOfMonth(gregorian);


这篇关于祈祷时间项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆