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 get date in following format Thursday, September 26, 2013.
The name of day should be full like Monday not like Mon and same for the month format.
How to get this format?
Use php date function as below.
echo date('l,F d,Y',strtotime($date));
Date Format
I got this like following way
$mydate=getdate(date("U"));
echo "$mydate[weekday], $mydate[month] $mydate[mday], $mydate[year]";
OR
$today = date(DATE_RFC822);
echo date('l,F d,Y',strtotime($today));
Related
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
Given today's date, is there an elegant way to get the previous Sunday's and the next Saturday's date?
So, given today's date of 12/12/2013, I would want to get back 12/8/2013 for the Sunday and 12/14/2013 for the Saturday.
If given a Sunday, for example 12/15/2013, I would want to get back 12/15/2013 for the Sunday and 12/21/2013 for the Saturday.
If given a Saturday, for example 12/21/2013, I would want to get back 12/15/2013 for the Sunday and 12/21/2013 for the Saturday.
And so on.
Any ideas?
DateTime() accepts relative formats:
echo (new DateTime('last Saturday'))->format("Y-m-d");
echo (new DateTime('next Saturday'))->format("Y-m-d");
See it in action
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.';
}
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);
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've a string like "2013-05-07"
and I want to convert it in "7 May 2013" via any functional way (if available) or in short method as possible
$dt = new DateTime('2013-05-07');
echo $dt->format('j F Y');
As of PHP 5.4
echo (new DateTime('2013-05-07'))->format('j F Y');
PHP Date Format
echo date('j F Y', strtotime("2013-05-07"));
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);