/ @param args /
Date date = new Date();
static Calendar calendar = Calendar.getInstance();
public void todays(){
calendar.set(2009, 12, 16, 14, 20, 30);
date = calendar.getTime();
DateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String s = formatDate.format(date);
System.out.println(s);
}
public static void main(String args) {
DateTest dt = new DateTest();
dt.todays();
}
}
This code running result 2009-12-16 why not 14:20:30
But 2010-01-16:02:20:30
Consult the master where there are problems?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You appear to be on the wrong forum, Dev-C++ does not support Java; the clue
is in the name. Moreover you are not going to get much help unless you get the
code mark-up right!
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateTest {
/
@param args
/
Date date = new Date();
static Calendar calendar = Calendar.getInstance();
public void todays(){
calendar.set(2009, 12, 16, 14, 20, 30);
date = calendar.getTime();
DateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String s = formatDate.format(date);
System.out.println(s);
}
public static void main(String args) {
DateTest dt = new DateTest();
dt.todays();
}
}
This code running result 2009-12-16 why not 14:20:30
But 2010-01-16:02:20:30
Consult the master where there are problems?
You appear to be on the wrong forum, Dev-C++ does not support Java; the clue
is in the name. Moreover you are not going to get much help unless you get the
code mark-up right!
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateTest {
/
@param args
/
Date date = new Date();
static Calendar calendar = Calendar.getInstance();
public void todays(){
calendar.set(2009, 12, 16, 14, 20, 30);
date = calendar.getTime();
DateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String s = formatDate.format(date);
System.out.println(s);
}
public static void main(String args) {
DateTest dt = new DateTest();
dt.todays();
}
}
This code running result 2009-12-16 why not 14:20:30
But 2010-01-16:02:20:30
Consult the master where there are problems?