[Opensource] Formatting dates

DComeau at xenos.com DComeau at xenos.com
Fri Apr 11 12:23:51 PDT 2003


I think so, this is what I have:

<type-mapping>
	<java-type>DATE</java-type>
	<db-type>datetime</db-type>
</type-mapping>
<type-mapping>
	<java-type>datetime</java-type>
	<db-type>datetime</db-type>
</type-mapping>


I'm working with another developer on the same code, and he can get the
dates into the datebase with code like this:

// set up default values
if (pwdChangeDate.length() == 0) {
    //pwdChangeDate= "2000-01-01 00:00:00";
    Calendar now = Calendar.getInstance();
    int year = now.get(Calendar.YEAR);
    int month = now.get(Calendar.MONTH)+1;
    int day = now.get(Calendar.DAY_OF_MONTH);
    int hour = now.get(Calendar.HOUR_OF_DAY);
    int minute = now.get(Calendar.MINUTE);
    int second = now.get(Calendar.SECOND);
    pwdChangeDate = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;

}

But that's hardcoded to match the dateTimeUpdateFormat format defined:

<snip>
dateSelectFormat="dd-MM-yyyy"
dateUpdateFormat="dd-MM-yyyy"
dateTimeSelectFormat="yyyy-MM-dd HH:mm:ss"
dateTimeUpdateFormat="yyyy-MM-dd HH:mm:ss"
</snip>

But wait a minute...I *might* see what the problem is now...I was trying to
format for the plain "date" format rather than "datetime" format?

Maybe that's all that's wrong...

Thanks,
Dave




-----Original Message-----
From: D Lloyd [mailto:orbacle at yahoo.com]
Sent: Friday, April 11, 2003 12:33 PM
To: opensource at jcorporate.com
Subject: Re: [Opensource] Formatting dates



--- DComeau at xenos.com wrote:
> 
> Hi all,
> 
> I'm having trouble with getting my date fields inserted into my database
> 
> 
 
Do you have the following type mapping (taken from a previous post)?

<type-mapping>
 <java-type>DATE</java-type>
 <db-type>datetime</db-type>
</type-mapping>

David Lloyd
david AT lloydhome DOT com


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20030411/b2b12f11/attachment-0002.htm


More information about the Opensource mailing list