Here you can find the source of getWeek(String date)
Parameter | Description |
---|
public static String getWeek(String date)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String _DEFAULT1 = "yyyy-MM-dd HH:mm"; public static final String _DEFAULT4 = "yyyy-MM-dd"; public static final String _DEFAULT_CN_WEEK1 = "E"; public static String getWeek(String date) { Date dates = null;//from ww w. j a va2s.c om String week = null; try { dates = new SimpleDateFormat(_DEFAULT1).parse(date); week = formatDate(dates, _DEFAULT_CN_WEEK1); } catch (ParseException e) { e.printStackTrace(); } return week; } public static String formatDate(Date date) { return formatDate(date, _DEFAULT1); } public static String formatDate(Date date, String style) { return new SimpleDateFormat(style).format(date); } public static String format(Date date) { return formatDate(date, _DEFAULT4); } }