Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 404161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:16:59+00:00 2026-05-12T17:16:59+00:00

I have never used Informix before and I’m trying to write a query that

  • 0

I have never used Informix before and I’m trying to write a query that will return records over the last 365 days.

Here is the query I have been trying to use:

Select * from Visit where vis_mod_dt between today-365 and today;

That returns no records even though I know that there is data for the last 365 days. I am guessing that the vis_mod_dt in not a true date column, although it displays as ’12/31/1899′ I have tried to cast this column using:

select * from visit where date(vis_mod_dt) between today-365 and today;

This still returns no data.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:16:59+00:00Added an answer on May 12, 2026 at 5:16 pm

    Informix DATE format

    Be aware that the date 1899-12-31 corresponds to the internal date representation of zero (0). That is, internally, Informix stores DATE values in a 4-byte integer, and counts the number of days since 1899-12-31, so Day 1 was 1900-01-01 (and since it knows that 1900 was not a leap year, Day 60 was 1900-03-01).

    That fact makes me worry about what is in your table. However, if the data in your table cannot be converted to a DATE upon request, normally you would get an error.

    What is your table schema?

    It would be sensible for you to establish the schema either using DB-Access and the Info/Tables option, or use DB-Schema:

    dbschema -d dbase -t visit
    

    The DB-Schema output is more suitable for adding to your question.

    The query expressions using ‘TODAY-365’ and ‘TODAY’ should work fine – if there is data to select.

    DBDATE environment variable

    There is an environment variable, DBDATE, that you may need to set to get things to work – to convert from a string representation to dates. Since you are probably based in the UK (from your icon), then you may want and need to set the value of DBDATE to:

    export DBDATE=DMY4/
    

    This says that dates consist of the day, the month, a 4-digit year and the ‘/’ is used as the preferred separator. You won’t be surprised to learn that the presumed default value is usually ‘MDY4/’, for US format; I use ‘Y4MD-‘ habitually, so I see DATE value the same as DATETIME YEAR TO DAY, which is the ISO 8601:2004 notation for a date. (It has many benefits: it is unambiguous, and naive sorting algorithms sort such dates into date order.) There’s actually a lot of mechanism in the background in IDS (IBM Informix Dynamic Server – which, I assume, is the DBMS that you are using; there are some alternatives that are also Informix DBMS) such that strings with 2-digit dates will usually be converted correctly (but they are ambiguous and undesirable), and separators other than ‘/’ will be recognized on input, but the slash will be used on ‘output’ (when converting DATE to string).


    Information needed to improve the answer to this question – 1st Edition.

    If what is here does not help, then I recommend editing your question to include:

    1. The table schema.
    2. A few (2-4) rows of data that you think should be selected but aren’t.
    3. Platform and version information. It can help to have the version down to the level of detail of IDS 11.50.FC4W1; occasionally it matters. Most usually, the first three digits are what affect things, of course.

    If your table is big (many columns), try to select the key columns (vis_mod_dt is by far the most important one). Ideally, you won’t need any scroll bars in the display.
    Make sure you don’t include any sensitive information.


    Information needed to improve the answer to this question – 2nd Edition

    I will help you if you pay attention to the questions I ask you. I cannot help you if you do not pay attention to the questions I ask. And please edit your question rather than adding information as an ‘answer’.

    • What is the table schema? What is the output from:

      SELECT t.tabid, t.tabname, c.colno, c.colname, c.coltype, c.collength
        FROM "informix".systables AS t, "informix".syscolumns AS c
       WHERE t.tabid = c.tabid
         AND t.tabname = "visit"
       ORDER BY t.tabid, c.colno;
      
    • What do you get from:

      SELECT TODAY, TODAY-365 FROM "informix".systables WHERE tabid = 1;
      
    • Do you have the environment variable DBDATE set? If so, what is its value?

    • Do you have the environment variables CLIENT_LOCALE or DB_LOCALE set? If so, what are their values?
    • Which version of Informix are you using?
    • Which platform are you using it on?
    • Which language or tool are you using to run the query.

    Note: if you cannot copy’n’paste the queries above, then you probably do not need to include the quoted ‘”informix”.’ attributes on the system catalog; however, as written, the queries will work on any extant Informix database – OnLine 5.x, SE 5.x or 7.x, IDS 7.x, XPS 8.x, IDS 9.x or 10.x or 11.x – and any mode of database (unlogged, logged, MODE ANSI). I’d use the JOIN notation except that some of the older versions don’t support it – though you have to be on very old versions for that to be a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to understand that - I have never used it before. How is
I have never used list before. I have created a website with over 30
I have never used CRON or anything like that, rails etc.. before, but I
I have never used regex before and I was wondering how to write a
I have never used DBpedia/SPARQL before. How can I make a query to select,
I have never used ajax before and am trying to fully understand this example
I have never used jQuery before and I'm trying to do something really simple
So, I have never used devise before and am trying to implement it in
I have never used Foxpro before. Can you convert the following Foxpro code into
I have never used array_combine before and I am getting a Boolean instead of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.