In php if we provide a particulr date how to display the name of the day i.e; whether that day lies on sunday or monday...

Can you please give me idea.

Recommended Answers

All 5 Replies

Convert that date to unixtimestamp using strtotime. Then use date("l") to get the day.
http://in.php.net/date
eg.

$date = "2009-03-31";
$timestamp = strtotime($date);
echo date("l",$timestamp);

I want to dsiplay it irrespective of year for example if i give the date that belongs to year 1987 it should display the day with respect to present year.

I want to dsiplay it irrespective of year for example if i give the date that belongs to year 1987 it should display the day with respect to present year.

Yes. That is what it does. Try out that example by giving 1987's date :)

I gave input as previous year but tried to looking for present year.
Thank you so much.

You are welcome :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.