Forums Register Login

How to get System Date and time

+Pie Number of slices to send: Send
I am trying to save a xml file. I want to retrieve
the system date and name the file as systemdate
stamp like mmddyyhrminutes(in this format).
Do you know how to retrieve system date and
format it in that way
+Pie Number of slices to send: Send
You can get the current date/time by simply creating a java.util.Date instance with the default constructor. If you need to use a java.sql.Date for whatever reason, you need to initialize it as new java.sql.Date( System.currentTimeMillis() ).
You can format the date as you like using a java.text.DateFormat instance.
hth,
bear
+Pie Number of slices to send: Send
Moving this from Servlets -> Java In General - Beginner
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2284 times.
Similar Threads
compare two dates thru Calendar
How to get System Date and time
<bean:write/> of struts1
how to get system date and format it
how to get system date and format it
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:54:06.