Results 1 to 4 of 4

Thread: [MySQL] Equivalent to MSSQL?[RESOLVED]

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Resolved [MySQL] Equivalent to MSSQL?[RESOLVED]

    Hey in MSSQL when i want to check a column to see if its older than five minutes i do

    Code:
      DATEDIFF(minute,time_column,GETDATE()) <= 5
    Is there an an equivalent in MySQL? or do i have to create the date in PHP and compare that value to the one in my DB?

    Thanks
    Last edited by john tindell; Jan 31st, 2005 at 11:38 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [MySQL] Equivalent to MSSQL?

    No, DATEDIFF will return days.

    I think you would need to use TIMEDIFF, SUBDATE or DATE_SUB to subtract and find the difference.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [MySQL] Equivalent to MSSQL?

    Found it! Behold, my google skills:

    http://dev.mysql.com/doc/mysql/en/da...functions.html

  4. #4

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: [MySQL] Equivalent to MSSQL?

    Cheers, was searching for the wrong thing

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