• 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

comparing dates in different formats

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to compare dates in different formats.
In the table the field (let's call it revoke_date) is defined as a Date type, and data is stored like 02-Dec-2005.

The application sends in data to the JSP in mm/dd/yyyy format, stored in variable vDate, type String.

How can I do soemthin like "select * from tbl1 where revoke_date = vDate"
properly?

Thank you.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by gino jersey:
(let's call it revoke_date) is defined as a Date type, and data is stored like 02-Dec-2005.



No, no database that I know of stores a date like that, it displays it that way when you look at the data, however every DB I know of stores this as a number value, the number of millisecs (Or whatever it uses, Oracle now uses NanoSec) after an epoc date

Every DB has a function that allows dates to be converted to a Varchar in whatever format you want.

In Oracle this would be
 
reply
    Bookmark Topic Watch Topic
  • New Topic