This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes SQL server date format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "SQL server date format" Watch "SQL server date format" New topic
Author

SQL server date format

Anthony Leroy
Greenhorn

Joined: Aug 02, 2001
Posts: 20
hi,
SQL server uses North American date format i.e. MM/dd/yy. How can I make it so that when I insert a value into a datetime field in regular British/Australian date format (dd/MM/yy) it doesn't interpret it wrongly?
thanks,
Ant
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Convert it to North American format!
Although for simple cases you can do this with string functions, Java also has 2 classes defined for data known to be of type "date". java.sql.Date is the simpler of the two, and is designed to be the wrapped when fetching/receiving data from a database (for example, via JDBC). java.util.Date is the more powerful for manipulation of dates and intervals. Associated with these is the DateFormat and Calendar classes, so you can customize date formatting for whatever representation and calendar system you prefer - American, Australo-English or even Moslem!


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL server date format