开发者

How to get a day of the week for a selected date using PHP? [duplicate]

开发者 https://www.devze.com 2023-03-06 23:50 出处:网络
This question already has answers here:开发者_运维技巧 Closed 11 years ago. Possible Duplicate: How to find day of week in php
This question already has answers here:开发者_运维技巧 Closed 11 years ago.

Possible Duplicate:

How to find day of week in php

I want to get the day of the week of the selected date. For example 05/19/2011 = Thursday


Here's how to do it for the current time:

$day=strftime("%A",time());

Or for a specific date:

$day=strftime("%A",strtotime("2011-05-19"));


Use strtotime() and date().

// below first parameter is lowercase "L"
$day_of_the_week = date('l', strtotime($your_date));


You can use date() and strtotime().

date('l', strtotime($date));

CodePad.


Use date and strtotime function. More about DATE

#date("format", int_timestamp);
#date("l", strtotime($date) );
$day= date("l", strtotime("05/19/2011") );
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号