CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 ___ How to build and display a list of dynamic dates?

Print topic Send  topic

Author Message
bigtoe

Posts: 115
Posted: 08/05/2004, 9:04 PM

Assume that today is "Thu Aug 5, 2004"

How can I populate my (single select) listbox with these 11 entries:

Sun Aug 8, 2004
Sat Aug 7, 2004
Fri Aug 6, 2004
Thu Aug 5, 2004
Wed Aug 4, 2004
Tue Aug 3, 2004
Mon Aug 2, 2004
Sun Aug 1, 2004
Sat Aug 31, 2004
Fri Aug 30, 2004
Thu Aug 29, 2004

Meaning that:
1. Figure out today's date.
2. Prepend 3 future days to it.
3. Append 7 past days to it.
4. Make this list of 11 entries.
5. Sort the list in descending order.
6. Display this in the listbox.
7. Make today the default selection. (Thu Aug 5, 2004)


View profile  Send private message
DonB
Posted: 08/06/2004, 6:00 AM

Joe Celko addresses this problem in some detail in his book "SQL for
Smarties." In a nutshell, the calendar cycles (repeats) every 28 years so a
table with around 10K rows can represent the entire cycle, making it easy to
write a query that retrieves a set of records for most any range of dates.
This is a more-generalized solution (i.e., a bit of overkill for your case)
but very effective and simple.

A purely-CCS way is to consider building a ListOfValues that you build
on-the-fly. How you do this is documented in the help.

And what's with the underscores in the subject line of all of your posts???
--
DonB

http://www.gotodon.com/ccbth


"bigtoe" <bigtoe@forum.codecharge> wrote in message
news:541130340bde54@news.codecharge.com...
> Assume that today is "Thu Aug 5, 2004"
>
> How can I populate my (single select) listbox with these 11 entries:
>
> Sun Aug 8, 2004
> Sat Aug 7, 2004
> Fri Aug 6, 2004
> Thu Aug 5, 2004
> Wed Aug 4, 2004
> Tue Aug 3, 2004
> Mon Aug 2, 2004
> Sun Aug 1, 2004
> Sat Aug 31, 2004
> Fri Aug 30, 2004
> Thu Aug 29, 2004
>
> Meaning that:
> 1. Figure out today's date.
> 2. Prepend 3 future days to it.
> 3. Append 7 past days to it.
> 4. Make this list of 11 entries.
> 5. Sort the list in descending order.
> 6. Display this in the listbox.
> 7. Make today the default selection. (Thu Aug 5, 2004)
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

bigtoe

Posts: 115
Posted: 08/10/2004, 2:11 AM

Thanks for the help.

The underscores in the subject line of my posts just make it easier for me to identify my posts.

I have a visual impairment. When I am using a computer that is not my own, the underscores help me out.

View profile  Send private message
Damian Hupfeld
Posted: 02/24/2005, 12:38 PM

Did you get this to work?

"bigtoe" <bigtoe@forum.codecharge> wrote in message
news:541130340bde54@news.codecharge.com...
> Assume that today is "Thu Aug 5, 2004"
>
> How can I populate my (single select) listbox with these 11 entries:
>
> Sun Aug 8, 2004
> Sat Aug 7, 2004
> Fri Aug 6, 2004
> Thu Aug 5, 2004
> Wed Aug 4, 2004
> Tue Aug 3, 2004
> Mon Aug 2, 2004
> Sun Aug 1, 2004
> Sat Aug 31, 2004
> Fri Aug 30, 2004
> Thu Aug 29, 2004
>
> Meaning that:
> 1. Figure out today's date.
> 2. Prepend 3 future days to it.
> 3. Append 7 past days to it.
> 4. Make this list of 11 entries.
> 5. Sort the list in descending order.
> 6. Display this in the listbox.
> 7. Make today the default selection. (Thu Aug 5, 2004)
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Rick

Posts: 52
Posted: 02/25/2005, 6:18 AM

This may be only part of what you are looking for but I think htis listbox code should work adding days to current date and displaying them in a listbox field. Of course you could also subtract dates and change it to a display format you want.

$financial->textdateshort->Values = array(array(date ("m-d-y",mktime (0,0,0,date("m"), date("d")+1, date("Y"))), date ("m-d-y",mktime (0,0,0,date("m"), date("d")+1, date("Y")))), array(date ("m-d-y",mktime (0,0,0,date("m"), date("d")+2, date("Y"))), date ("m-d-y",mktime (0,0,0,date("m"), date("d")+2, date("Y")))), array(date ("m-d-y",mktime (0,0,0,date("m"), date("d")+3, date("Y"))), date ("m-d-y",mktime (0,0,0,date("m"), date("d")+3, date("Y")))));

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.