• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting a Four Digit Date from SQL call

 
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting remote data from a db2 data source. Eventhough the date field I am getting my data from has a four digit year my SQL result only has two digit year. Please help. When ever I try and change the format of the date to a four digit after it is returned I get a year like 0009

My connection is using:
import com.ibm.as400.access.AS400JDBCDataSource;

My SQL:
String sqlmin = "Select MIN(ftdatem) As minDate From " + this.ls + ".resmngt3 Where projindex = " + arg0;
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What type is the column "ftdatem"? Date? Numeric? String?

Also, I don't see any code there which claims to change the format of a date, so it's hard to say much about that.
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The datatype is Date.

After more looking I found that this will do the trick. Thanks for the reply.

String sqlmin = "Select CHAR(MIN(ftdatem),USA) As minDate From " + this.ls + ".resmngt3 Where projindex = " + arg0;
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the JDBC forum.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic