SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can get the year,month ... from timestamp?

    Hi ..

    I have in my db (mysql) timestamp field, how can I select the data by year, month,day, and hour from DB ?

  2. #2
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this the right way :

    year :
    select year(now(unix_timestamp());
    month:
    select month(now(unix_timestamp());
    day
    select dayofmonth(now(unix_timestamp());

    but how to get the hours ?!


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
  •