SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    find month, have hour, minute, day, week and year

    i have hour, minute, day, week and year in a database, but i added a month column, so with hour, minute, day, week and year - how can i find month?

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2007
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Impossible unless your day/week values are day of the year not day of the month.

  3. #3
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What makes you think it's impossible? It's quite easy actually.

    @cssExp: what "day" you've got? Is that calendar day (25th), or day of week ("Sunday") or day of year?

  4. #4
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What makes you think it's impossible? It's quite easy actually
    If the data has day or week of the month then, like Speeple, I don't see how the month could be determined.

  5. #5
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Who on the earth uses "week of the month"?
    Anyways, I think we just wait for OP's comments.

  6. #6
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stereofrog View Post
    What makes you think it's impossible? It's quite easy actually.

    @cssExp: what "day" you've got? Is that calendar day (25th), or day of week ("Sunday") or day of year?
    day like 17 etc..the type of day you'll get if you use
    Code PHP:
    date('d');

    the problem is, i have a dynamic database driven system, each data is entered with year, week etc.. 2 months ago assuming I'll create sort option in future i put everything, i.e year, week, hour, minute etc.. but forgot month. Now that i'm adding sort option but i need month but not any

  7. #7
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And the "week"? Is it what date("W") returns, or something else?

  8. #8
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $year = date('Y');
    $week = date('W');
    $day = date('d');
    $hour = date('H');
    $minute = date('i');
    Last edited by cssExp; Oct 18, 2007 at 09:49.

  9. #9
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So any way to find month using week?

    edit
    ----

    figured out a way around it, problem solved.
    Last edited by cssExp; Oct 18, 2007 at 22:34.


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
  •