📲 Download Our Apps

EMI Calculator

Download EMI Calculator

SOA Games

Download SOA Games

SOA Technology App

Download SOA Technology

BMI Checker

Download BMI Checker

Task Jira

Download Task Jira

Laughing Adda

Download Laughing Adda

📅 हिंदी कैलेंडर ऐप डाउनलोड करें

Download Shubhcalendar App

get day from date in php

To get the day from a date in PHP, you can use the date() function in conjunction with strtotime() or the DateTime class.

1. Using date() and strtotime():

The date() function formats a local date/time, and strtotime() parses an English textual datetime description into a Unix timestamp.

<?php
$dateString = '2025-10-07'; // Your date string
$dayNameFull = date('l', strtotime($dateString)); // Full day name (e.g., Tuesday)
$dayNameShort = date('D', strtotime($dateString)); // Short day name (e.g., Tue)
$dayOfMonth = date('d', strtotime($dateString)); // Day of the month (e.g., 07)

echo "Full day name: " . $dayNameFull . "\n";
echo "Short day name: " . $dayNameShort . "\n";
echo "Day of the month: " . $dayOfMonth . "\n";
?>

2. Using the DateTime class:

The DateTime class provides a more object-oriented approach to working with dates and times.

<?php
$dateString = '2025-10-07'; // Your date string
$dateTime = new DateTime($dateString);

$dayNameFull = $dateTime->format('l'); // Full day name (e.g., Tuesday)
$dayNameShort = $dateTime->format('D'); // Short day name (e.g., Tue)
$dayOfMonth = $dateTime->format('d'); // Day of the month (e.g., 07)

echo "Full day name: " . $dayNameFull . "\n";
echo "Short day name: " . $dayNameShort . "\n";
echo "Day of the month: " . $dayOfMonth . "\n";
?>

Explanation of Format Characters:

  • l (lowercase L): A full textual representation of the day of the week (e.g., “Sunday” through “Saturday”).
  • D: A three-letter textual representation of a day (e.g., “Mon” through “Sun”).
  • d: Day of the month, 2 digits with leading zeros (e.g., “01” to “31”).



Leave a Reply

AI Spiritual Tools & Interactive Experiences

Explore powerful AI-driven tools for daily guidance, spirituality, fun quizzes, and self-discovery.

Today’s Quote

Get inspiring daily quotes powered by AI to motivate and guide your day.

Explore Now

AI Tarot Card Reader

Reveal insights about your future, love, and career with AI tarot readings.

Read Tarot

Love Match Calculator

Check compatibility and love predictions using AI-based analysis.

Check Match

Fortune Cookie

Open an AI fortune cookie and receive wisdom, luck, and fun messages.

Open Cookie

Quiz Categories

Engage with knowledge-based and fun quizzes across multiple categories.

Start Quiz

Panchang Calendar

View daily Panchang, auspicious timings, tithi, nakshatra, and festivals.

View Panchang

Online Numerology

Discover your destiny number, life path, and numerology predictions.

Calculate Now

Spiritual Feeds

Stay connected with spiritual thoughts, mantras, and divine content.

View Feeds

Quiz Hub

Attempt trending quizzes on GK, spirituality, festivals, and more.

Explore Quizzes