SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard cmuench's Avatar
    Join Date
    Jul 2005
    Location
    At my computer
    Posts
    2,251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    latest 2 weeks from the current date (was "Query question")

    I have a query question. My date format is in this form
    Sun, 06 Nov 2005 8:30:00 EST
    Now there will be numerous records in the table date field. I need to get the latest 2 weeks from the table. It will be a sort of calendar application and I need to get the latest 2 weeks from the current date? Now how word I do this query? Thanks for any ideas.

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    look in the mysql manual under date and time functions. you want to take the current time stamp, subtract 2 weeks and compare that to your timestamps.

  3. #3
    SitePoint Wizard cmuench's Avatar
    Join Date
    Jul 2005
    Location
    At my computer
    Posts
    2,251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry should have worded it differently. I need the next 2weeks of events from today

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    the same advice still applies. you want all events between current timestamp and current timestamp + 2 weeks. all of the functions you need are on the link i provided above.

  5. #5
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you will be out of luck since you don't have valid date types if you are storing:
    Sun, 06 Nov 2005 8:30:00 EST
    or are you actually storing them as a valid datetime type and just displaying them as
    Sun, 06 Nov 2005 8:30:00 EST


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
  •