event calender date problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adamrain
Forum Newbie
Posts: 15
Joined: Thu Jun 03, 2010 5:35 am

event calender date problem

Post by adamrain »

hi, im making an event calender and having a problem with a variable containing the time stamp here is the code.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$day=date('j');
$month=date('n');
$year=date('y');

echo$day."/".$month."/".$year; 

$curentTimestamp=strtotime("$day-$month-$year");
$monthname=date("f",$curentTimestamp);
$numdays=date("t",$curentTimestamp);
$counter=0;

?>
<table width="200" border="1">
  <tr>
    <td>&nbsp;</td>
    <td colspan="5"><?php echo $monthname;?></td>
   
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width='50'>sun</td>
    <td width='50'>mon</td>
    <td width='50'>tue</td>
    <td width='50'>wed</td>
    <td width='50'>thu</td>
    <td width='50'>fri</td>
    <td width='50'>sat</td>
  </tr>
</table>
</body>
</html>
here is the line whith the problem

Code: Select all

$curentTimestamp=strtotime("$day-$month-$year");
im not so good with dates even without php and im not so good with the date func,but i know ill need the time stemp for things like month or year,later.
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: event calender date problem

Post by markusn00b »

What exactly is your problem?
adamrain
Forum Newbie
Posts: 15
Joined: Thu Jun 03, 2010 5:35 am

Re: event calender date problem

Post by adamrain »

it dosnt show the month when i use the time stemp it showes "f"
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: event calender date problem

Post by AbraCadaver »

adamrain wrote:it dosnt show the month when i use the time stemp it showes "f"
Are you sure there is a format "f"? How about "F"?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
adamrain
Forum Newbie
Posts: 15
Joined: Thu Jun 03, 2010 5:35 am

Re: event calender date problem

Post by adamrain »

I feel so stupid it worked! there is no f format my bad....such a simple error and i couldnt handle it thank you man, thank you forum.
Post Reply