Newbie date from DB question

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Newbie date from DB question

    Probably a simple thing for most of you but....

    I have an Access DB with a date field which holds month, date, year, and time
    whch are all populated. I also have a form which passes a selected value for
    the month, ie: 1 for Jan, 2 for Feb. etc. into a CF page to retrieve and
    display records.

    My desire is to be able to pull only the records from the database for a
    specific month then order them by the date within that month, then by time for
    display. It sounds easy and it should be... but I cannot seem contruct the
    "where" and "order by" based on only part of the retrieved date field.

    ghouser Guest

  2. Similar Questions and Discussions

    1. Newbie can't get date range search from form to work
      Please help! I'm banging my head against a wall here. This is my first stab at ASP. I'm able to pass vars from a form to a search results page...
    2. Pen Tool Use Question. (Embarrassingly Newbie Question)
      I'm currently using Flash MX and whenever I choose the Pen Tool instead of the pen nib with the small "x" beside it that supposed to show up on...
    3. newbie: day number in year to gregorian date?
      Hi, I'm trying to convert a serial day int to a gregorian date. It is very easy the other way by using date("z"), but the other way around is a...
    4. converting date into database date format(newbie)
      Hi! U can convert "8-Aug-03" into mysql date which requires yyyy-mm-dd format as below. <?php date("Y-m-d",strtotime("8-Aug-03")); ?>
    5. formatting a date field in a datagrid colum - newbie
      I'm working with a datagrid control and needing to format a date field(from access) so that it just has dd/mm. Do I format it in the Tag or in ...
  3. #2

    Default Re: Newbie date from DB question

    One possibility...

    SELECT your_fields
    FROM your_table
    WHERE month(date_field) = #form.month#
    ORDER BY date_field

    Phil
    paross1 Guest

  4. #3

    Default Re: Newbie date from DB question

    It's going to depend on which database you use, and the date formatting
    functions that database has. In Postgresql, it's date_part.

    eg:
    select * from tbleventlog where date_part('day',logdate) = 16 and
    date_part('month',logdate) = 3 order by logdate;

    I don't know what it is in Access, but you can search on "date formatting".

    Kronin555 Guest

  5. #4

    Default Re: Newbie date from DB question

    I tried something very similar to what you posted Phil but not quite the same.
    So what you are saying is that month() will return just the month portion of
    the date field value. I can believe it is that simple but I couldn't find that
    function as you used it. I did find date_part() which I thought might work as
    well.

    I'll try what you suggest and see if it works as easy as I expect it will.
    Thanks!

    ghouser Guest

  6. #5

    Default Re: Newbie date from DB question

    From the Access 97 Help...

    Month Function
    Returns a Variant (Integer) specifying a whole number between 1 and 12,
    inclusive, representing the month of the year.
    Syntax
    Month(date)
    The required date argument is any Variant, numeric expression, string
    expression, or any combination, that can represent a date. If date contains
    Null, Null is returned.

    Phil

    paross1 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139