Date function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • toufik toufik

    #1

    Date function

    I've asked this question last week, Thanks for your answers, but I still
    having the ambiguity.
    I need to have a date using today's date and a number of days:
    dateX = todays date - x number of days

    can someone give me an example of php code . thanks.

    I'm using windows, appache server.


  • Geoff Berrow

    #2
    Re: Date function

    I noticed that Message-ID: <sEL0c.5947$qA2 .333894@news20. bellglobal.com>
    from toufik toufik contained the following:
    [color=blue]
    >I've asked this question last week, Thanks for your answers, but I still
    >having the ambiguity.
    >I need to have a date using today's date and a number of days:
    >dateX = todays date - x number of days
    >
    >can someone give me an example of php code . thanks.[/color]

    print date("F jS, Y", strtotime("-x days"));
    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Tom Thackrey

      #3
      Re: Date function


      On 1-Mar-2004, "toufik toufik" <toufiki@sympat ico.ca> wrote:
      [color=blue]
      > I've asked this question last week, Thanks for your answers, but I still
      > having the ambiguity.
      > I need to have a date using today's date and a number of days:
      > dateX = todays date - x number of days[/color]

      $x = 3;

      $dateX = date('Y-m-d',strtotime("- $x day")); // assuming you want the date
      in a string format

      $dateX = strtotime("- $x day"); // if you want the date as a unix timestamp

      --
      Tom Thackrey

      tom (at) creative (dash) light (dot) com
      do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

      Comment

      • toufik toufik

        #4
        Re: Date function

        It works, thanks
        "Tom Thackrey" <use.signature@ nospam.com> wrote in message
        news:0dM0c.3220 5$QF5.14692@new ssvr25.news.pro digy.com...[color=blue]
        >
        > On 1-Mar-2004, "toufik toufik" <toufiki@sympat ico.ca> wrote:
        >[color=green]
        > > I've asked this question last week, Thanks for your answers, but I still
        > > having the ambiguity.
        > > I need to have a date using today's date and a number of days:
        > > dateX = todays date - x number of days[/color]
        >
        > $x = 3;
        >
        > $dateX = date('Y-m-d',strtotime("- $x day")); // assuming you want the[/color]
        date[color=blue]
        > in a string format
        >
        > $dateX = strtotime("- $x day"); // if you want the date as a unix[/color]
        timestamp[color=blue]
        >
        > --
        > Tom Thackrey
        > www.creative-light.com
        > tom (at) creative (dash) light (dot) com
        > do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)[/color]


        Comment

        Working...