The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
php mktime question
Hi there,
Im doing something to display when a monthly newsletter will be released which is always the 1st of the month, so i've setup a plugin that i'm intending to use to put the date into a variable $nextmonth. Problem is i cant seem to get the correct value. This is what i've got at the minute: Code:
$nextmonth = date("d/m/Y", mktime(0, 0, 0, 1, m+1, Y)); Effectively what i'm trying to achieve is that $nextmonth will currently have the value 01/02/2007 and if the date were say february now then it will be 01/03/2007 i.e. day will always be 01 month will be the next month and year will be next year if month is december. I've looked through lots of examples of this but cant really work out how to adapt it to what i need. Anyone got any idea how to do this? |
#2
|
|||
|
|||
Try this...
PHP Code:
|
#3
|
|||
|
|||
Thanks Noppid, the month seems to be doing what its supposed to but the date is coming out as 02/01/2007 rather than 01/02/2007
Any ideas? |
#4
|
||||
|
||||
PHP Code:
|
#5
|
|||
|
|||
Quote:
PHP Code:
|
#6
|
|||
|
|||
Quote:
got one question with regards to this, would it carry the year over if say for example current date was mid december would it then correctly display 01/01/08 ? |
#7
|
||||
|
||||
From the looks of it, no, because the year is not programmed to be one year ahead in your specified circumstances.
|
#8
|
||||
|
||||
also, FYI if you were concerned with including a timestamp as well as the date, you would want to use the vbmktime function to ensure that the timestamp were in-synch with the recipient's selected timezone in their profile.
|
#9
|
||||
|
||||
Yep, vbdate too...
BTW not sure if you applied what I said in my post or not, but if you didn't your results will be incorrect next month. |
#10
|
|||
|
|||
Quote:
How would that need to be altered to take the year into account? Quote:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|