Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:40:20+00:00 2026-06-03T08:40:20+00:00

Possible Duplicate: Based on date, get todays and the next two days values from

  • 0

Possible Duplicate:
Based on date, get todays and the next two days values from XML?

I have asked some questions earlier, and thanks to excellent help from stackoverflow, i have solved a lot of the main issues. Thank you all!
I am extremely sorry if my questions are stupid, but i have tried to google as much as i can before asking here at stackoverflow.

I also have a working page where i can get specific prayer times and populate textblocks.
See this link and my marked question with the solution. There i use public timespan in the class and the var query:

How to make an if statement to show xml attribute based on current time

I am still working on the muslim PrayerTime app, and want to populate a listBox with todays+the next 3 days prayer times.

    DateTime myDay = DateTime.Now;
    XDocument loadedCustomData = XDocument.Load("WimPrayerTime.xml");
    var filteredData = from c in loadedCustomData.Descendants("PrayerTime")
                       where c.Attribute("Day").Value == myDay.Day.ToString()
                       && c.Attribute("Month").Value == myDay.Month.ToString()

                       select new PrayerTime()
                       {
                           Fajr = c.Attribute("Fajr").Value,
                           Soloppgang = c.Attribute("Soloppgang").Value,
                           Zohr = c.Attribute("Zohr").Value,
                       };

    listBox1.ItemsSource = filteredData;

my Class is:

public class Prayertime
{

   public string Fajr { get; set; }
   public string Sunrise { get; set; }
   public string Zohr { get; set; }

}

my local XML file (always included in the app it self)

<PrayerTime
    Day ="30" 
    Month="4" 
    Fajr="07:00" 
    Sunrise="09:00"
    Zuhr="14:00"
/>
<PrayerTime
    Day ="1" 
    Month="5" 
    Fajr="07:05" 
    Sunrise="09:05"
    Zuhr="14:05"
/>
<PrayerTime
    Day ="2" 
    Month="5" 
    Fajr="07:10" 
    Sunrise="09:10"
    Zuhr="14:10"
/>

First of all, how to change this code to show me a list of today plus the next three days?

where c.Attribute("Day").Value == myDay.Day.ToString()

Or should i make one query for each day,
DateTime NextDay = DateTime.Now.AddDays(1) and so on? How to i populate the same listBox with three or four different querys like this?
Can i just repeat this:

listBox1.ItemsSource = filteredData1;
listBox1.ItemsSource = filteredData2;
listBox1.ItemsSource = filteredData3;

Also, what to do when the month changes? For example, if the date is 30 and month is 4 next day will be value 1 and month should then show 5?

Last but not least.. when showing the information i want the listBox to show it like:

Monday 30.04.2012
Fajr        07:00
Sunrise     09:00
Zuhr        14:00

Tuesday 01.05.2012
Fajr        07:05
Sunrise     09:10
Zuhr        14:10

where i have a fixed spacing between the Attribute name and value, and the date/day above.

Thank you very much to everyone who takes the time to read, and huge thanks to everyone who answers:)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:40:21+00:00Added an answer on June 3, 2026 at 8:40 am

    Try this:

    where int.Parse(c.Attribute("Day").Value) >= myDay.Day && int.Parse(c.Attribute("Day").Value) < (myDay.Day + 3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Test for NA and select values based on result Suppose you have
Possible Duplicate: Join lines based on pattern I have the following file: test one
Possible Duplicate: Python: simple list merging based on intersections I have a multiple list:
Possible Duplicate: xpath select elements between two nodes based on this html i need
Possible Duplicate: Easy way of populating Javabeans based on request parameters Hi, I have
Possible Duplicate: Split string based on delimiter in bash? i have a shell script
Possible Duplicate: jQuery select based on text I have something like this: <span>abc</span> <span>a</span>
Possible Duplicate: SimpleXML get element content based on attribute value I've looked through several
Possible Duplicate: Finding weekend days based on culture Is there any locale info available
Possible Duplicate: display dropdown values based on previous dropdown I know html pretty well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.