In an app I'm working on I have to maintain date information across a system that encompasses Oracle, SQL Server VB and Java. To do this I store the dates on both databases and in XML directly using the format you mentioned "yyyyMMddHHmmss" (in a char(14) in the dbs).
Because all developers can be assured that dates will be stored in exactly that format, which is always GMT, its fairly trivial to subclass Java's Date class to take that String as a constructor param. Because the date info is msd to lsd in the String, its also easy to use SQL to retrieve dates in order, or filter by using the 'like' operator. AndyB -----Original Message----- From: Zoran Avtarovski [mailto:[EMAIL PROTECTED] Sent: 25 September 2003 00:42 To: Struts User Group Subject: MS SQL Server Dates I'm using an existing MS SQL Server for a small web app. I'm doing a query based on daily activity. I build my query using a string buffer which looks like "SELECT * FROM artciles WHERE " + date1SQL + "<=submitted and date_entered < " + date2SQL Where date1SQL and date2SQL are strings formatted "yyyyMMddHHmmss" My question is, is this the best way to do it. Submitted is a smalldatetime field and both date1 and date2 are GregorianCalender objects which I canvert as required. Any help would be appreciated. Zoran --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]