Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Get Server Time and Insert into Database


Message #1 by "Roy Ngan" <bean_00@h...> on Fri, 5 Jan 2001 03:05:15 -0000
2 possible solutions

- Use the SimpleDateFormat object to format a Date to a proper String
- (preferred) use PreparedStatements and use setDate()

Geert Van Damme

> -----Original Message-----
> From: Roy Ngan [mailto:bean_00@h...]
> Sent: dinsdag 9 januari 2001 2:20
> To: Pro_JavaServer_Pages
> Subject: [pro_jsp] Re: Get Server Time and Insert into Database
>
>
> Dear,
>
>     I actually need to insert the date is the format (yyyy-mm-dd
> hh:mm:ss), but if I using the statement that :
>
> sqlpct = "Insert into ProductCategory (PctCode, PctDesc, PctStatus,
> AdmLastDate) values('" + PctCode + "', '" + PctDesc + "', '" + PctStatus +
> "', #" + dNow + "#)";
>
> then the dNow will have the value "Tue Jan 09 09:15:09 GMT+08:00 2001",
> which is not acceptable for my database, any way to format the above date
> to the (yyyy-mm-dd hh:mm:ss) format?
>
> Thank you.

--- 
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development, 
Web Development, Networking & Communications, and Hardware & Systems.  
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to pro_jsp as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-pro_jsp-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index