SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: query help

  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up query help

    hi
    i have posted my question before but i think i could not elaborate it properly so again posting it.so plz dont't mind it co zi really need help in it.

    i was using this query

    "SELECT FROM_UNIXTIME(date, '%Y-%m-%d') AS formatted_date FROM table1 GROUP BY formatted_date order by formatted_date desc "

    to get the dates day by day where 'date' is the attraibute in which i am storing the 10 digits seconds e.g ' 1192568563'.

    now what i want is that to add 8 hours in my date like this

    "SELECT FROM_UNIXTIME(date+28800, '%Y-%m-%d') AS formatted_date FROM table1 GROUP BY formatted_date order by formatted_date desc "

    so adding seconds of 8 hours.

    but problem i sthat it works fine on my local machine but not on my server.

    one thing more i found this function also "DATE_FORMAT(DATE_ADD(date, INTERVAL 8 HOUR), '%Y-%m-%d')" but i have date in seconds like '1192587456' and i have to add seconds but here alos error.

    wht can i do to make it? is thier any other way alos??????
    its urgent plzzz.....
    regards
    phphelp

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    Moscow, Russia
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but problem i sthat it works fine on my local machine but not on my server.
    Hi, what's wrong with the result set on the server? ( ' 1192568563' is Unix timestamp value? )

    one thing more i found this function also "DATE_FORMAT(DATE_ADD(date, INTERVAL 8 HOUR), '%Y-%m-%d')" but i have date in seconds like '1192587456' and i have to add seconds but here alos error.
    'date' must be DATETIME (i.e. 'YYYY-MM-DD HH:MM:SS' string or YYYYMMDDHHMMSS number) or DATE value (i.e. 'YYYY-MM-DD' or YYYYMMDD) appropriately. Check 11.3.1. The DATETIME, DATE, and TIMESTAMP Types


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
  •