Results 1 to 2 of 2

Thread: Weekday !

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Weekday !

    Hi,

    I want to find the weekday from a given month, date and year. If my input is May 11, 2008 then my output will be Monday. Is there any way to get it using PHP ? Please help.

    Thank you so much in advance.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Weekday !

    Give this a shot.

    PHP Code:
    $DayOfWeek date("l"parsedate("11/05/2008"));

    echo 
    $DayOfWeek//Returns Sunday

    function parsedate($value)
    {
       
    // If it looks like a UK date dd/mm/yy, reformat to US date mm/dd/yy so strtotime can parse it.
       
    $reformatted preg_replace("/^\s*([0-9]{1,2})[\/\. -]+([0-9]{1,2})[\/\. -]+([0-9]{1,4})/""\\2/\\1/\\3"$value);
       return 
    strtotime($reformatted);


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width