Jump to content

Archived

This topic is now archived and is closed to further replies.

FuG5333

PHP Calendar

Recommended Posts

Well, so far I've made a calendar and it looks and functions the way I need it to.  The issue is, how do I do something like:  "If it's tuesday, put a link to signup.  But only on Tuesdays."?

Share this post


Link to post
Share on other sites
I think you could do something like

[code]<?php
$datestamp = n; //wherever you get your date from
if(strtotime("l",$datestamp) == "Tuesday"){
//do whatever
}
?>
[/code]

note: that is a lower case 'L' and not a number "1"

Share this post


Link to post
Share on other sites
I think micah meant [b]if(date("l",$datestamp)=="Tuesday")[/b] instead of [b]if(strtotime("l",$datestamp) == "Tuesday")[/b]

Share this post


Link to post
Share on other sites
Here's what I have so far.  The error is something about "T_ENCAPSED_AND_WHITESPACE".

[code]<?php
$todaysdate = ".$_SERVER['PHP_SELF']."?date=".mktime(0,0,0,$month -1,$d,$year).";
  if(strtotime("l",$datestamp) == "Tuesday"){
    echo "$todaysdate";
  }
?>[/code]

My goal is to get only Tuesdays to show up with a signup link.  This is the first step.  If I can figure how to put something in only Tuesdays, then I get put a link later.  The problem is, I'm trying to eventually save each signup as a 20060610 type of date so the signups can be linked to that date only.  Making sense?

Share this post


Link to post
Share on other sites
<?
$date=getdate();

$today_date=$date[weekday];

echo $today_date;

if ($today_date =="Tuesday") {

//add code
}

?>

Share this post


Link to post
Share on other sites
[quote]I think micah meant if(date("l",$datestamp)=="Tuesday") instead of if(strtotime("l",$datestamp) == "Tuesday")[/quote]

I think I meant that too.  oops  :-[

Share this post


Link to post
Share on other sites
[quote author=redarrow link=topic=100105.msg394792#msg394792 date=1152569986]
<?
$date=getdate();

$today_date=$date[weekday];

echo $today_date;

if ($today_date =="Tuesday") {

//add code
}

?>
[/quote]

You need to enclose weekday in single or double quotes, else it's a constant. Like [code]$today_date=$date['weekday'][/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.