Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get Date ?  RSS feed

 
Engin Okucu
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to insert a row in the database. The date format must be as follow :
"5/05/2004 15:20:10"
Thanks for helping.
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use java.text.SimpleFormat

Dan
 
Engin Okucu
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thank you very much. It works
An example for anyone who is interested in :
import java.text.*;
import java.util.*;
public class Test
{
public static void main(String ar[])
{
SimpleDateFormat formatter = new SimpleDateFormat ("dd/MM/yy hh:mm:ss");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);

System.err.println("Date --> : " +dateString );

}

}
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess this thread is finished, but I'm moving it to the Java in General (beginner) forum anyway
Dave
 
kelvin cheung
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
may i ask you whats the difference between : system.out and system.err ?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kelvin,
Perhaps your question would be best placed in a new thread.
So, I'll start one for you...
[ May 06, 2004: Message edited by: Dirk Schreckmann ]
 
Brian Pipa
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread has one of the funniest subjects I have seen yet
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Brian Pipa:
This thread has one of the funniest subjects I have seen yet

Indeed. I was trying to think of a good joke. "Doesn't being a Java programming do it for you?"
 
Jason Fox
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sorry, its friday, couldn't resist.
[ May 07, 2004: Message edited by: Jason Fox ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!