3

If I have a query, that returns a date or time range, how do get the upper or lower bound?

For example, Ramadan 1436 returns: Thursday, June 18, 2015 to Friday, July 17, 2015 Another example is fajr time in New York City, which returns a range.

How do I pull out the start or end of any range, to chain it up with other queries?

I'm only interested in a generic solution, not a specific one.

3

I don't think W|A will meet your needs. It is not apparently designed to support complex chaining of datetime calculations. As proof, observe the following ...

first day of (ramadan 1436) in Gregorian calendar = Thursday, June 18, 2015

correct

hours from ( 12:01 am UTC, Thursday, June 18, 2015) to (23:59 pm UTC, Friday, July 17, 2015) = 720 hours aka 30 days

correct

but a simple substitution in brackets gives ...

hours from ( 12:01 am UTC, (first day of (ramadan 1436) in Gregorian calendar)) to (23:59 pm UTC, Friday, July 17, 2015)

... a senseless answer by adding in extra assumed terms.

as regard finding fractions of datetime ranges only basic queries seem to work. For example

0.75 * (hours from ( 12:01 am UTC, Thursday, June 18, 2015) to (23:59 pm UTC, Friday, July 17, 2015)) = 540 hours

works

but W|A cannot understand adding a start date to that as follows ...

( 12:01 am UTC, Thursday, June 18, 2015) + (0.75 * (hours from ( 12:01 am UTC, Thursday, June 18, 2015) to (23:59 pm UTC, Friday, July 17, 2015)))

answer to earlier version of question

this works for the first day

first day of (ramadan 1436) in Gregorian calendar = Thursday, June 18, 2015

and this works for the final day

(first day of (ramadan 1436) in Gregorian calendar) + (number of days in ramadan 1436) - (1 day) = Friday, July 17, 2015

  • How would you do it for time ranges? – Pureferret May 29 '15 at 11:19
  • not sure I understand clearly. "Thursday, June 18, 2015 to Friday, July 17, 2015" is a "time range". can you give an exact example of a "time range" and exactly the answer you expect ? please. You might want to consider asking this as a separate question. – John McNamara May 29 '15 at 11:27
  • Initially I was going to add one, as searching on W|A for prayer times would give a start and end range as a time (rather than a date). But that feature doen't seem to be working at the moment... – Pureferret May 29 '15 at 11:29
  • would something like "time of Fajr today in new york city" help you ? – John McNamara May 29 '15 at 11:49
  • time of Fajr today in new york city give me: 3:30 am EDT to 5:30 am EDT which again a range. Is there a generic way to get that? – Pureferret May 29 '15 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.