You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Keith <pd...@pdragon.net> on 2004/08/16 19:17:58 UTC

Display Taglib & Dates

I just got the Display taglib to try and make some of my job a little easier. Things
seemed to be going good til I ran across the problem of a date field. I'm pulling from an
Oracle database, so the following query:

<sql:query var="projects">
	SELECT a.project_id, 
		a.project_name,
		a.kickoff_date
	FROM project_main a
	ORDER BY project_id DESC
</sql:query>

returns something like this:

10016
Project1234
2004-07-15 00:00:00.0

I'd like to format the date field to look like this: 15-Jul-2004
Before, I just used the <fmt:formatDate> tag, but I'm at a loss for how to use it in
conjuction with the display taglib. I tried using the TO_CHAR function in the database
query to format my date beforehand, but then it doesn't return any date information at
all. Any help?

Keith






---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Display Taglib & Dates

Posted by David Schwartz <ds...@arrayone.com>.
You should be doing that in the query, using Oracle functions.
Try...

SELECT a.project_id,
a.project_name,
To_Char(a.kickoff_date, 'MM/DD/YYYY' ) AS Kickoff_Date
FROM project_main a
ORDER BY project_id DESC


Quoting Keith <pd...@pdragon.net>:

>> I just got the Display taglib to try and make some of my job a little
>> easier. Things
>> seemed to be going good til I ran across the problem of a date field. I'm
>> pulling from an
>> Oracle database, so the following query:
>>
>> <sql:query var="projects">
>> 	SELECT a.project_id,
>> 		a.project_name,
>> 		a.kickoff_date
>> 	FROM project_main a
>> 	ORDER BY project_id DESC
>> </sql:query>
>>
>> returns something like this:
>>
>> 10016
>> Project1234
>> 2004-07-15 00:00:00.0
>>
>> I'd like to format the date field to look like this: 15-Jul-2004
>> Before, I just used the <fmt:formatDate> tag, but I'm at a loss for how to
>> use it in
>> conjuction with the display taglib. I tried using the TO_CHAR function in
>> the database
>> query to format my date beforehand, but then it doesn't return any date
>> information at
>> all. Any help?
>>
>> Keith
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>
>>


David Schwartz
Array Software Inc.
http://www.arrayone.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Display Taglib & Dates

Posted by David Schwartz <ds...@arrayone.com>.
For the format 15-Jul-2004 its To_Date(a.kickoff_date).

Quoting Keith <pd...@pdragon.net>:

>> I just got the Display taglib to try and make some of my job a little
>> easier. Things
>> seemed to be going good til I ran across the problem of a date field. I'm
>> pulling from an
>> Oracle database, so the following query:
>>
>> <sql:query var="projects">
>> 	SELECT a.project_id,
>> 		a.project_name,
>> 		a.kickoff_date
>> 	FROM project_main a
>> 	ORDER BY project_id DESC
>> </sql:query>
>>
>> returns something like this:
>>
>> 10016
>> Project1234
>> 2004-07-15 00:00:00.0
>>
>> I'd like to format the date field to look like this: 15-Jul-2004
>> Before, I just used the <fmt:formatDate> tag, but I'm at a loss for how to
>> use it in
>> conjuction with the display taglib. I tried using the TO_CHAR function in
>> the database
>> query to format my date beforehand, but then it doesn't return any date
>> information at
>> all. Any help?
>>
>> Keith
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>
>>


David Schwartz
Array Software Inc.
http://www.arrayone.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org