How to convert this double prayer time to regular time?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: How to convert this double prayer time to regular time?

  1. #1
    Join Date
    Jan 2008
    Posts
    98

    How to convert this double prayer time to regular time?

    I've posted a thread about this topic, but It seems dead already, and I haven't got the answer,
    So forgive me for another post!
    I just wanna calculate the prayer time in middle east country!
    I can get the latitude and longitude data, and compute sunrise and sunset time.

    I find a site http://www.tanzil.info/praytime/doc/calculation/
    which give direction to compute prayer time!
    But I have some questions about the formula given in the webpage!

    Firstly, I am not sure in this formula, Does it take east longitude as negative, west longitude as positive?
    (Because in the formula of computing sunrise and sunset, It takes east longitude as negative, west longitude as positive. North latitude as positive, South latitude as negative)

    Secondly, It seems the results computed by the formula are doubles, which are not as
    regular time, How can I convert them to regular time?
    Really need your help, Thanks!

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: How to convert this double prayer time to regular time?

    Quote Originally Posted by fantasy1215 View Post
    I've posted a thread about this topic, but It seems dead already, and I haven't got the answer,
    So forgive me for another post!
    I just wanna calculate the prayer time in middle east country!
    I can get the latitude and longitude data, and compute sunrise and sunset time.

    I find a site http://www.tanzil.info/praytime/doc/calculation/
    which give direction to compute prayer time!
    But I have some questions about the formula given in the webpage!
    Which formula? There are several on that page.
    Firstly, I am not sure in this formula, Does it take east longitude as negative, west longitude as positive?
    (Because in the formula of computing sunrise and sunset, It takes east longitude as negative, west longitude as positive. North latitude as positive, South latitude as negative)
    That is typical for Lat/Lon coordinates
    Secondly, It seems the results computed by the formula are doubles, which are not as
    regular time, How can I convert them to regular time?
    Really need your help, Thanks!
    From looking at the site, it's probably returning Julian dates. You may need to read up on how to convert to some other format:

    http://en.wikipedia.org/wiki/Julian_date

  3. #3
    Join Date
    Jan 2008
    Posts
    98

    Re: How to convert this double prayer time to regular time?

    hoxsiew, thanks for your reply!
    I substitute my latitude 22 North, longitude -113(113 East), timezone +8 into these formulas,
    but the prayer time I get seems not Julian time at all. Now I'll post my in face computation,
    Please point out the places where's wrong!


    d = jd - 2451545.0; // jd is the given Julian date, the Julian date of 2010/03/10 is 2455265.5000
    d = 2455265.5000 - 2451545.0 = 3720.5

    g = 357.529 + 0.98560028* d;
    g = 357.529 + 0.98560028* 3720.5 = 4024.9476418

    q = 280.459 + 0.98564736* d;
    q = 280.459 + 0.98564736* 3720.5 = 3948.05282656

    L = q + 1.915* sin(g) + 0.020* sin(2*g); // here I convert g to radians. so g's radians is 70.2485873714
    L = q + 1.915* sin(70.2485873714) + 0.020* sin(2*70.2485873714) = 3949.803010038

    R = 1.00014 - 0.01671* cos(g) - 0.00014* cos(2*g);
    R = 1.00014 - 0.01671* cos(70.2485873714) - 0.00014* cos(2*70.2485873714) = 0.993154006621

    e = 23.439 - 0.00000036* d;
    e = 23.439 - 0.00000036* 3720.5 = 23.43766044

    RA = arctan2(cos(e)* sin(L), cos(L))/ 15;//here I convert e and L to radians.
    e radians is 0.4090643366; L radians is 68.937066154406

    RA = arctan2(cos(0.4090643366)* sin(68.937066154406), cos(68.937066154406))/ 15
    = -0.0109039393163

    D = arcsin(sin(e)* sin(L)); // declination of the Sun
    D = arcsin(sin(0.4090643366)* sin(68.937066154406)) = -0.070473394414

    EqT = q/15 - RA; // equation of time
    EqT = q/15 - RA = 3948.05282656/15 - (-0.0109039393163) = 263.21442570998

    Dhuhr = 12 + TimeZone - Lng/15 - EqT.
    //Lng in my case is 113 East,
    I don't know whether I use negative or positive, but I do use -113, if I should use positive,
    please tell me, And timezone is +8.

    Dhuhr = 12 + 8 - (-113)/15 - 263.21442570998 = -235.64375904332



    I don't think the time Dhuhr -235.64375904332 is Julian date. Where am I wrong?

    Wait your reply, thanks in advance!

  4. #4
    Join Date
    Feb 2005
    Posts
    2,160

    Re: How to convert this double prayer time to regular time?

    Well, if the map on my wall is correct, 113W (-113) puts you in the Pacific Ocean, a few hundred km off the coast of Baja California Sur, Mexico. 113E (+113) puts you in China a few hundred km from Hong Kong.

    As for the rest of it, I can't make much sense of it. I'll take another look at the site you mentioned.

  5. #5
    Join Date
    Jan 2008
    Posts
    98

    Re: How to convert this double prayer time to regular time?

    Is there some Islamic people who can give me a guide!
    Really need your help!

  6. #6
    Join Date
    Jun 2011
    Posts
    3

    Re: How to convert this double prayer time to regular time?

    Hello fantasy,

    I am also working on that isue. Have you solved that problem?

    kind regards from Germany

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,471

    Re: How to convert this double prayer time to regular time?

    Quote Originally Posted by martinger View Post
    I am also working on that isue. Have you solved that problem?
    What "isue" / problem do you mean:
    getting a guide from "some Islamic people ..."
    or the "Prayer Times Calculation"
    or ... what exactly?
    Victor Nijegorodov

  8. #8
    Join Date
    Jun 2011
    Posts
    3

    Re: How to convert this double prayer time to regular time?

    Quote Originally Posted by VictorN View Post
    What "isue" / problem do you mean:
    getting a guide from "some Islamic people ..."
    or the "Prayer Times Calculation"
    or ... what exactly?
    No, sorry.
    I want to calculate the Dhuhr time like Fantasy did in the past.
    With the same equation I got a similar value like -235.64375904332.
    My question is: is this value in minutes, seconds or what? It can't be houres because it should show the Dhuhr time on a specific date (given Julian Date) and on a specific location (depending on Longitude and Latitude).

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,471

    Re: How to convert this double prayer time to regular time?

    Quote Originally Posted by martinger View Post
    No, sorry.
    I want to calculate the Dhuhr time like Fantasy did in the past.
    With the same equation I got a similar value like -235.64375904332.
    Well, if you used "the same equation" the OP had used its
    's not surprising that you got "a similar value".

    Did you try the code the link in the http://praytimes.org/calculation/ points to: this page?
    Victor Nijegorodov

  10. #10
    Join Date
    Jun 2011
    Posts
    3

    Re: How to convert this double prayer time to regular time?

    Quote Originally Posted by VictorN View Post
    Well, if you used "the same equation" the OP had used its
    's not surprising that you got "a similar value".

    Did you try the code the link in the http://praytimes.org/calculation/ points to: this page?
    Hi,

    well, no. Thanks for that! I've tried to program it by myself .
    I will check the code.
    I will post the solution asap.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center