function mktime() not working properly [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I want to find first day of next month.
So i use
$firstDayNextMonth = date('Y-m-01', strtotime('first day of next month'));
but it was not working in server.
Then i found a question in stackoverflow. Solution use
$firstDayNextMonth =`date('Y-m-d', mktime(0,0,0,date('n')-1,1,date('Y')))`
but that give wrong answer.

<?php
echo date('Y-m-d', mktime(0,0,0,date('n')+1,1,date('Y')));
?>
demo

Related

format a DateTime in php with format "JJJJ-MM-TTTss:mmZZZ" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm trying to format a date like Google specifies to format it
the format specified by Google is :
" JJJJ-MM-TTTss:mmZZZ "
What I tried so far is:
var_dump(date_format($date,'Y-M-D H:m:s'));
results in
"2013-Aug-Wed 18:08:37"
when I try to uses googles format like
var_dump(date_format($date,'JJJJ-MM-TTTss:mmZZZ'));
it results in
JJJJ-AugAug-CESTCESTCEST3737:0808720072007200"
I have no idea what it should look like, any help?
thanks in advance
What about this?
$date = date_create();
print date_format($date, 'Y-m-d\TH:iT');
Output:
2014-03-24T10:43CET
As i understand you are reading non english version of google manual, in english this date format looks like
YYYY-MM-DDThh:mmTZD
and example of this is
1997-07-16T19:20+01:00
You can try to produce this in PHP like this
echo date("Y-m-d\TH:s", time());

Showing a message if specific times on specific days [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to show a message on my site if it's after 5:00 PM on Thursday, and the whole day Friday.
I managed to get the code to work for Friday, but don't have any idea how to also get it to show on Thursday after 5.
Here's what I have so far:
$d=date("D");
if ($d=="Fri")
{
echo 'Items may ship out after the weekend.';
}
How can I also get this to show on Thursday after 5:00?
Thanks!
You can try this:
$d=date("D");
if ($d=="Fri" || ($d=="Thu" && date("Hi")>="1700")) {
echo 'Items may ship out after the weekend.';
}

How to compare two timestamps without seconds? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have two timestamps: one from time() function, other selects user in front-end. I need to compare this two timestamps, but ignore the seconds or set it to 00. What is the proper way to do this?
Had some time for an example:
$nr = 1111111122;
$nr = substr($nr, 0, strlen($nr)-2) . "00";
echo strtotime(date('Y-m-d H:i:00', time()));

Calculate time stamp from date and time given by user [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my application, the user gives 2 inputs — one is date and the other is time:
$date = date("d-M-Y");
$time=date("h:m:s");
How can I calculate a time stamp from these two variables in PHP?
actually i take the date form date picker and time from time oicker.....
If you want time stamp then use this
echo strtotime($date.' '.$time);

how to increment the current date which is in d/m/Y format by one month [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i want to increment the current date by one month which is in d/m/Y format
but i have no idea about this,can any one give me a relevant example.
thanks in advance
In PHP you do this:
$time = strtotime("+1 month", time());
$date = date("d/m/Y", $time);

Categories