SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Almeaty Member
    Join Date
    Jul 2000
    Location
    Nowhere
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello, in a mysql-db I have set a column to hold the timestamp ( time(), int(11) ). what i want to do is getting all entries of the current month... i tried with WHERE MONTH(date)=$month, but this won't work...

    any ideas? thx

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DIMA the reason that won't work is because you cannot use mysql date functions on non-date columns. Since you have your timestamp in a int(11) field you won't be able to use date functions. I would suggest storing them in a date field as YYYY-MM-DD. You can always convert to unix timestamp if you want from your query but keeping it as date field will give you access to all the date functions in MySQL. Is there a specific reason for storing them as unix timestamps in a int(11) field? If there is maybe we can try and change that. Just let us know why you chose that and we can go from there.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Don't forget that Unix timestamps only go back as far as 1970, so they have limited use anyway.


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
  •