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

  • Home
  • SEARCH
  • 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 101753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:49:55+00:00 2026-05-11T00:49:55+00:00

I have Informix database with timestamp field defined as YEAR TO SECOND. When I

  • 0

I have Informix database with timestamp field defined as YEAR TO SECOND. When I show this field using JDBC rs.getString(column) it uses format with miliseconds so this field looks like:

2008-12-18 13:58:14.0 

I would like it to use only YEAR TO SECOND fields. I set environment variable:

GL_DATETIME=%Y-%m-%D %H:%M:%S 

but even then I got miliseconds. Programs using ODBC do not show milisecond. How can I receive TIMESTAMP string ‘YEAR TO SECOND’ only? In my program I can check metadata if field is TIMESTAMP and then cut ‘.0’, but I think there should be simplier way.

Server version: IBM Informix Dynamic Server Version 11.50.TC2DE

Client version: IBM Informix JDBC Driver for IBM Informix Dynamic Server 3.50.JC3DE

EDIT It looks that all other JDBC drivers I tested (Oracle and PostgreSQL) shows Timestamp columns with miliseconds if I use getString(). So I used solution proposed by Todd. I check metatdata and if column is Timestamp then I use getTimestamp() and format it.

  • 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. 2026-05-11T00:49:56+00:00Added an answer on May 11, 2026 at 12:49 am

    If you are using JDBC, you can use the rs.getDate(column) or rs.getTimestamp(column) methods, which return Date and Timestamp objects respectively. Then you have an object representing time, rather than a String expressing it directly. With Date or Timestamp, you can use a date formatter to format it to whatever String representation of that time you choose.

    Update (after reading comments below): If you use getDate(), it will still work for Timestamp columns. It will just reduce the precision down to the second. That way you don’t have to check the metadata, you just have to know that the column is some kind of timestamp or date.

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

Sidebar

Ask A Question

Stats

  • Questions 77k
  • Answers 77k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer When you're searching by descendants and element, you need to… May 11, 2026 at 3:35 pm
  • added an answer I believe this line: cgi.out( 'cookie' => [cookie] ){''} Is… May 11, 2026 at 3:35 pm
  • added an answer All transactions are inserting\updating in the same order. Deletes; identify… May 11, 2026 at 3:35 pm

Related Questions

I have an Informix database containing measured temperature values for quite a few different
We are trying to duplicate one of our informix database on a test server,
Many developers seem to be either intimidated or a bit overwhelmed when an application
I have problem when I try insert some data to Informix TEXT column via

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.