On 6 Mar 2006 at 21:37, Mark Whitby wrote:
> Dear all,
>
> Apologies if this isn't really relevant but I'm struggling for what to
> do! I have a table in a MySQL database with a DATE column in the
> format yyyy-mm-dd (incidentally does anyone know how to change this?)
> and I'm trying to do a date entry and comparison using a Java Servlet.
> However I can't for the life of me work out how to extract the
> current date using a Java Servlet and I've searched everywhere I can
> with no luck!
>
Are you trying to retrieve a time field from a mysql database or are you trying
to determine
the current date/time?
Or are you trying to get the date from a httpsession (as your subject
indicates)?
If retrieving from a mysql db you can use
java.sql.Timestamp lastlogintime = rs.getTimestamp("column-name");
(rs being a ResultSet)
If determing current time
java.sql.Timestamp now = new java.sql.Timestamp(System.currentTimeMillis());
-Steve O.
«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»§«¤»¥«¤»
There's no obfuscated Perl contest because it's pointless.
- Jeff Polk
Steve O.
http://www.steveo.us
New pics: B17G and B24
http://www.steveo.us/B17-B24
B17G WWII Bomber "Yankee Lady" Flight
http://www.steveo.us/b17ride
SUNY NCC MATH/COMPUTER Dept.
http://www.matcmp.ncc.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]