aspose file tools*
The moose likes JDBC and the fly likes Date Extraction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Date Extraction" Watch "Date Extraction" New topic
Author

Date Extraction

Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey i have a table in which i have a field with date & time but its data type is date

now i want to comapre my this field on basis of month & year entered by me

Now i want to know how can i extract month & year only from my this field in database

Please help me

thank you
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Does this help?



http://developer.postgresql.org/pgdocs/postgres/functions-datetime.html


Swastik
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

Which of course won't work in several other servers like MS SQL Server. That one has functions YEAR, MONTH, DAY and DATEPART. So without knowing the database server in question we cannot answer this question (unless we provide the answer for each and every database server available).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Date Extraction