How to count just weekdays in Bubble.io
In this Bubble tutorial, you'll learn how to exclude certain days of the week from a list of dates in your Bubble app.
Exclude weekends from your date range: Learn how to filter out Saturdays and Sundays in your Bubble date picker with this quick tutorial!
Count only weekdays in Bubble: Discover the simple trick to conditionally count just business days in your date calculations.
Master date filtering in Bubble: Unlock the power of custom date ranges and learn how to manipulate date lists like a pro.
Introducing the Video Tutorial
Have you ever wondered how you can exclude certain days of the week from a list of dates in your Bubble app? Well, I'm going to show you in this video. But before I dive into it, we've got hundreds of Bubble tutorial videos that you can't find on YouTube. You can only find them on our website planetnocode.com, so join our no-code app builder community there today.
Demonstrating the Date Picker Functionality
Let me just demo this. It's going to be really quick. I've got a date picker here. The particular date picker I'm using is by Zeroqode. It's the air date/time picker, and I've got it added to my page here. I've got just a default range, so I'm saying today's current date time and then I'm adding in 12 days. You can see that today is indeed Friday, but it skips Saturday and Sunday, then goes through the next week and then skips the following Saturday and Sunday until it arrives at that plus 12 days.
Explaining the Implementation
So let me show you how I've gone about and done this. The air date time picker version 2, which is I think the only one that's now available (that's because of the changeover the response vengeance), anyway it should look like this. You can say selected range as a list and then you can filter that list. So you can say this date, and we're talking about an individual date in the list now, and we can extract the day.
When we extract the day in Bubble, it returns like an index value of days starting from Sunday. So Sunday returns zero. That's why I'm saying not zero, and then Monday would return one, and it counts all the way through to Saturday. So Saturday is six, so that's why I've got these constraints in there.
Formatting the Output
Then I'm simply saying format in a way that I can clearly demonstrate to you the day of the week and the date. Then I'm using join with and line_break, and that has enabled me to get this list here where each item is listed on a separate line. Notice it doesn't actually print line break. That is how you use join with to achieve a line break when you're joining together a list of text items.
Counting Weekdays
I'll show you one other thing here. What if we wanted to just know how many there were? So let's add in a text label. I'm going to say the air date time picker selected range as list, and then I will do basically build up the same thing. I will filter. I'll say this date extract (easy to get these mixed up) day is going to be that 0 to 6 Sunday to Saturday. Date is going to be well, today is the 5th of January, so it will be 5. So I want day is not zero to exclude Sundays and then 6. Now I've got my list and I can then simply say count. We'll preview that.
So there's nine. One, two, three, four, five, six, seven, eight, nine. Good, I was hoping that would total up.
Conclusion and Call to Action
Anyway, that's how you go about it. If you want to see any more Bubble tips and tricks, please like and subscribe to this video. If you want to see anything else about working with dates in Bubble, please leave a comment down below. We read every single one, and we generally are trying to be as helpful as possible to the Bubble and no-code community.
Get the Complete Bundle for Just $99
Access 3 courses, 390+ tutorials, and a vibrant community to support every step of your app-building journey.
Start building with total confidence
No more delays. With 30+ hours of expert content, you’ll have the insights needed to build effectively.
Find every solution in one place
No more searching across platforms for tutorials. Our bundle has everything you need, with 390+ videos covering every feature and technique.
Dive deep into every detail
Get beyond the basics with comprehensive, in-depth courses & no code tutorials that empower you to create a feature-rich, professional app.
Save over 70%!
Valued at $80
Valued at $85
Valued at $30
Valued at $110
Valued at $45
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
We're here to help you launch your no code SaaS. Reach out to the team and we'll double check our vast library for useful content. We'll advise you on how we'd tackle the same problem and there's a good chance we'll record the video to help the wider community.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.