Professional Web Applications Themes

Date format in CFMX "01-01-1970" - Coldfusion - Advanced Techniques

Hi, I have a bit of a problem recognizing the dates read from an Ingres databse. I am using Coldfusion MX7 and I run into the following scenarios: a) - if the database value is NULL, the CF returns a non date value. b) - if the databse value has been set to an empty string, CF returns "1970-01-01" Now, this can be dealt with and display the dates accordingly. But what happens when a date is really set to a valid date of "1970-01-01"? How would coldfusion check whether the database value is actually an empty string or "1970-01-01"? ...

  1. #1

    Default Date format in CFMX "01-01-1970"

    Hi,

    I have a bit of a problem recognizing the dates read from an Ingres databse.
    I am using Coldfusion MX7 and I run into the following scenarios:
    a) - if the database value is NULL, the CF returns a non date value.
    b) - if the databse value has been set to an empty string, CF returns
    "1970-01-01"

    Now, this can be dealt with and display the dates accordingly.
    But what happens when a date is really set to a valid date of "1970-01-01"?
    How would coldfusion check whether the database value is actually an empty
    string or "1970-01-01"?

    Anyone had this problem? Thanks.

    multiscan01 Guest

  2. #2

    Default Re: Date format in CFMX "01-01-1970"

    i imagine it's the database that's doing this (or the driver). wouldn't it be
    better to update the db to NULL for blanks (and fix whatever's causing this in
    the first place)? or can you filter these rows maybe casting the empty date
    columns to NULL? or do that and UNION it with non-NULL rows?


    PaulH Guest

  3. #3

    Default Re: Date format in CFMX "01-01-1970"

    multiscan01 wrote:
    > Hi,
    >
    > I have a bit of a problem recognizing the dates read from an Ingres databse.
    > I am using Coldfusion MX7 and I run into the following scenarios:
    > a) - if the database value is NULL, the CF returns a non date value.
    > b) - if the databse value has been set to an empty string, CF returns
    > "1970-01-01"
    Definitely wouldn't be CF just making this date up, so as Paul points
    out it's the DB or the driver doing this. Here's a second vote for
    making sure not to use 1-1-1970 as a "null" date. My car insurance
    company was doing that until I came along, and since my birtdate
    actually *is* 1/1/1970, they had to rework their system to accommodate
    me. As a web developer I laughed really hard when they told me this was
    the problem.

    Always a bad idea to use an actual value as a "dummy" value,
    particularly if it's a value that's a totally reasonable one. I'm not
    so old yet that my birthdate should serve as such! ;-)

    Matt

    --
    Matt Woodward
    Team Macromedia - ColdFusion
    mpwoodward *TMM* Guest

  4. #4

    Default Re: Date format in CFMX "01-01-1970"

    have to try to use single qoute in the insert or update query?

    date = '#newdate#'


    jorgepino Guest

  5. #5

    Default Re: Date format in CFMX "01-01-1970"

    also are you runing your site in a unix server if you are the 1970-01-01 i believe it is the default timestamps for unix machines
    i hope it help


    jorgepino Guest

  6. #6

    Default Re: Date format in CFMX "01-01-1970"

    Thank you all for your time. Yes the database running on linux machine and as
    Paul said I now believe it is the JDBC driver we are using. Yes, will go for
    eliminating the source of the problem., clean the current empty strings values
    and then interpreting the returned NULL values will be trivial. (thought I
    could cut corners this time. Nope!)
    Nice DOB Matt :-) ... as a web developer I am so frustrated when come accross
    this kind of things.


    multiscan01 Guest

Similar Threads

  1. #40717 [NEW]: date "01-01-1968" inaccessible via date function
    By manuel dot pinhao at nvisible dot pt in forum PHP Bugs
    Replies: 13
    Last Post: April 23rd, 02:47 PM
  2. #39106 [Opn->Bgs]: date("w") incompatible with date("W")
    By tony2001@php.net in forum PHP Bugs
    Replies: 0
    Last Post: October 10th, 10:53 AM
  3. #39106 [NEW]: date("w") incompatible with date("W")
    By felixmallek at gmx dot de in forum PHP Bugs
    Replies: 0
    Last Post: October 10th, 10:42 AM
  4. Replies: 0
    Last Post: August 5th, 12:30 AM
  5. Replies: 0
    Last Post: August 4th, 10:29 PM

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
  •  

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