SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: dates question

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    london
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dates question

    hi if i have the current date as

    $currentdate = date("j-M-y");

    How do i get yesterdays date in the same format.

    thanks.

  2. #2
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You use PHP's mktime function:

    $yesterday = date('j-M-y', mktime(0, 0, 0, date('n'), (date('j') - 1), date('Y')));

    Should do it.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    london
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks it works.


Bookmarks

Posting Permissions

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