28, May 2012

Last day of the month - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Last day of the month
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Last day of the month  (Read 1236 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« on: Oct 31, 2005, 01:20:10 pm »

I was wondering how you all worked out the last day of the month using php. The old script that I was using failed on me today (the last day of Oct)! Here is my script that returned 30.

Code:
<?phph
        $lastday 
date("d"mktime(000$_POST['month'], 0$_POST['year']));
?>


$_POST['month'] is 10 and $_POST['year'] is 2005.

wineo
« Last Edit: Oct 31, 2005, 03:48:46 pm by wineo »


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Oct 31, 2005, 01:41:21 pm »

If you want to check which is the last day of the month (or how many days the particular month has) run this :

Code:
<?php
    $lastday 
date "t" );
?>

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #2 on: Oct 31, 2005, 03:41:20 pm »

Ah yes, how simple! I should be able to just swap the "d" for a "t"...

Thanks! I will let you know how it goes.


Last blog : Canonical URL Links / Tags
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #3 on: Oct 31, 2005, 03:48:12 pm »

OK, I had to change the day to 1...

Code:
<?php
       $lastday 
date("t"mktime(000$_POST['month'], 1$_POST['year']));
?>


Thanks Nikolas!


Last blog : Canonical URL Links / Tags
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=579
Tags : php Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Last day of the month
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 05:59:19 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.