K
Kyote
I'm very new to Java and can't seem to figure this out. I'm running
the below code to try and understand Date and and formatting. But once
I run it, then try changing what the string is, it still outputs the
first strings value, although it is formatted. Why does it keep
displaying the value that test equaled when I first ran it? I'm using
1.3.1 API in WebSphere on a Windows XP machine if that helps any.
import java.text.SimpleDateFormat;
import java.util.Date;
public class TestDate {
public static void getMyDate(String dd) {
SimpleDateFormat sdf = new
SimpleDateFormat("M/d/yyyy");
Date dt = new Date();
dd = sdf.format(dt);
System.out.println(dd);
}
public static void main(String[] args) {
String test = null;
test = "10162003";
getMyDate(test);
}
}
Kyote
the below code to try and understand Date and and formatting. But once
I run it, then try changing what the string is, it still outputs the
first strings value, although it is formatted. Why does it keep
displaying the value that test equaled when I first ran it? I'm using
1.3.1 API in WebSphere on a Windows XP machine if that helps any.
import java.text.SimpleDateFormat;
import java.util.Date;
public class TestDate {
public static void getMyDate(String dd) {
SimpleDateFormat sdf = new
SimpleDateFormat("M/d/yyyy");
Date dt = new Date();
dd = sdf.format(dt);
System.out.println(dd);
}
public static void main(String[] args) {
String test = null;
test = "10162003";
getMyDate(test);
}
}
Kyote