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)
|
 |
 |
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.
|
 |
 |
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")))));
|
 |
 |
|