Dates

This is a discussion on Dates within the PHP General forums, part of the PHP Programming Forums category; I have extracted 2 dates using MySQL, StartDate and EndDate and also done a DATEDIFF to find out how many ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-14-2005
cybergoth_0@yahoo.co.uk
 
Posts: n/a
Default Dates

I have extracted 2 dates using MySQL, StartDate and EndDate and also
done a DATEDIFF to find out how many days between the two.

What I am wanting to do in PHP is Starting from the StartDate loop
around to a count of the DATEDIFF and add a checkbox with the day name
next to it. Just can't seem to work out the code.

A psuedo code example would be:

Loop until x = DATEDIFF
$DayName = format(StartDate, DATEADD(StartDate, x), '%D')
echo "<input type='checkbox' /> $DayName"
End

Reply With Quote
  #2 (permalink)  
Old 05-14-2005
Jonathan
 
Posts: n/a
Default Re: Dates

cybergoth_0@yahoo.co.uk wrote:
> I have extracted 2 dates using MySQL, StartDate and EndDate and also
> done a DATEDIFF to find out how many days between the two.
>
> What I am wanting to do in PHP is Starting from the StartDate loop
> around to a count of the DATEDIFF and add a checkbox with the day name
> next to it. Just can't seem to work out the code.
>
> A psuedo code example would be:
>
> Loop until x = DATEDIFF
> $DayName = format(StartDate, DATEADD(StartDate, x), '%D')
> echo "<input type='checkbox' /> $DayName"
> End
>

I think tou are looking for this function: strftime

http://www.php.net/manual/en/function.strftime.php

Jonathan

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Reply With Quote
  #3 (permalink)  
Old 05-14-2005
cybergoth_0@yahoo.co.uk
 
Posts: n/a
Default Re: Dates

Thanks

I just got round it with something like this, which may be clumsy to
people who know what they are doing but it works for me.

$DayName = Date('D', mktime(0,0,0,$MnthNum,$DyNum + $DCnt,$YrNum));

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:21 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0