Correcting my Date Output from SimpleDateFormat

后端 未结 2 1572
说谎
说谎 2021-01-27 03:42

I am having a problem: Trying to use SimpleDateFormat with user input...

public static void main(String[] args) {
try {
SimpleDateFormat sdf = new SimpleDateForm         


        
相关标签:
2条回答
  • 2021-01-27 03:58

    You should use small y - MM/dd/yyyy.

    This link should be your friend when dealing with date format problems.

    0 讨论(0)
  • 2021-01-27 04:17

    The new SimpleDateFormat("MM/dd/YYYY",Locale.US); must be new SimpleDateFormat("MM/dd/yyyy",Locale.US);

    • YYYY = Week year
    • yyyy = Year
    0 讨论(0)
提交回复
热议问题