strtotime abbreviations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sialater
    New Member
    • Mar 2008
    • 6

    #1

    strtotime abbreviations

    Hello,

    I've been trudging through the net trying to find possible abbreviations to find a specific date using strtotime()

    What I'm after is a way to find the first specific day of a month in the current year. For example, "The first Sunday of July".

    Thanks
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    I don't understand your question at all. You make the string as short as possible, containing only relevant info, and not words like 'the', 'in' etc. So this example from the PHP documentation works perfectly[php]<?php
    $str="first Sunday July";
    if (($timestamp = strtotime($str) ) === false) {
    echo "The string ($str) is bogus";
    } else {
    echo "$str == " . date('l dS \o\f F Y h:i:s A', $timestamp);
    }
    ?>[/php]results in
    Code:
    first Sunday July == Sunday 06th of July 2008 12:00:00 AM
    Ronald

    Comment

    • sialater
      New Member
      • Mar 2008
      • 6

      #3
      Apologies for the vague question, but you answered my question perfectly.

      I just didn't realise that strtotime() would recognise a string like that. I guess the basis for my question lies in what the function's capabilities are.

      Thank you for the help

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Glad that is what you were looking for. See you next time.

        Ronald

        Comment

        Working...