Date - drop down menu
am 04.04.2008 21:55:12 von Slickuser
Hi,
I would like to use date() function show in the drop down menu start
from today to next 1 Month.
So it will be something like this.
4/3/2008
4/4/2008
4/5/2008
.......
5/12008
5/2/2008
5/3/2008
Any idea? thanks
Re: Date - drop down menu
am 04.04.2008 22:26:43 von webmasterNOSPAMTHANKS
*** Slickuser escribió/wrote (Fri, 4 Apr 2008 12:55:12 -0700 (PDT)):
> I would like to use date() function show in the drop down menu start
> from today to next 1 Month.
>
> So it will be something like this.
>
> 4/3/2008
> 4/4/2008
> 4/5/2008
> ......
> 5/12008
> 5/2/2008
> 5/3/2008
Not fully tested but it should work:
$now = time();
$next_month = strtotime('+1 month', $now);
for($i=$now; $i<$next_month; $i=strtotime('+1 day', $i)){
echo date('Y-m-d', $i) . "\n";
}
?>
Adjust the format of the echo line to your liking.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Re: Date - drop down menu
am 04.04.2008 22:29:58 von Hans-Peter Sauer
<69a9f1a9-2995-4c84-a7aa-cab802a29c35@q10g2000prf.googlegroups.com>
> I would like to use date() function show in the drop down menu start
> from today to next 1 Month.
>
> So it will be something like this.
>
> 4/3/2008
> 4/4/2008
> 4/5/2008
> ......
> 5/12008
> 5/2/2008
> 5/3/2008
>
$rambo=1; $nuke=0;
while ($rambo<31)
{
$kill[$rambo]=date("D dS M",time()+$nuke);
$nuke=$nuke+386400;
$rambo=$rambo+1;
}
Untested - but something like this will generate 31 dates .
--
www.krustov.co.uk
Re: Date - drop down menu
am 04.04.2008 22:53:22 von webmasterNOSPAMTHANKS
*** Krustov escribió/wrote (Fri, 4 Apr 2008 21:29:58 +0100):
> $rambo=1; $nuke=0;
> while ($rambo<31)
> {
> $kill[$rambo]=date("D dS M",time()+$nuke);
....
Wow! It's the first script I find that's rated "adults only" for violent
content xD
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Re: Date - drop down menu
am 04.04.2008 23:59:02 von Jerry Stuckle
Slickuser wrote:
> Hi,
>
> I would like to use date() function show in the drop down menu start
> from today to next 1 Month.
>
> So it will be something like this.
>
> 4/3/2008
> 4/4/2008
> 4/5/2008
> ......
> 5/12008
> 5/2/2008
> 5/3/2008
>
> Any idea? thanks
>
Several ways to do it, but how about:
for ($i = 0; $i = 30; $i++)
echo "date('m/d/Y',strtotime("now + $i days"));
Add your html as necessary.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Date - drop down menu
am 06.04.2008 15:48:26 von nospam
Slickuser wrote:
> Hi,
>
> I would like to use date() function show in the drop down menu start
> from today to next 1 Month.
>
> So it will be something like this.
>
> 4/3/2008
> 4/4/2008
> 4/5/2008
> ......
> 5/12008
> 5/2/2008
> 5/3/2008
>
> Any idea? thanks
How about use some javascript gadgets?
http://marcgrabanski.com/code/ui-datepicker/
--
Xu, Qian (stanleyxu)
Re: Date - drop down menu
am 06.04.2008 17:14:55 von Jerry Stuckle
nospam wrote:
> Slickuser wrote:
>> Hi,
>>
>> I would like to use date() function show in the drop down menu start
>> from today to next 1 Month.
>>
>> So it will be something like this.
>>
>> 4/3/2008
>> 4/4/2008
>> 4/5/2008
>> ......
>> 5/12008
>> 5/2/2008
>> 5/3/2008
>>
>> Any idea? thanks
>
> How about use some javascript gadgets?
> http://marcgrabanski.com/code/ui-datepicker/
>
Why? PHP does it quite well - and doesn't require JS to be enabled on
the browser.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================