Here you can find the source of weekday(String date)
public static String weekday(String date) throws ParseException
//package com.java2s; /*// www . j ava 2 s.co m * Copyright (C) 2006-2016 Talend Inc. - www.talend.com * * This source code is available under agreement available at * %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt * * You should have received a copy of the agreement along with this program; if not, write to Talend SA 9 rue Pages * 92150 Suresnes, France */ import java.text.DateFormat; import java.text.ParseException; import java.util.Calendar; import java.util.Date; public class Main { public static String weekday(String date) throws ParseException { Calendar calendar = Calendar.getInstance(); DateFormat dateFormat = DateFormat.getDateInstance(); Date da = null; da = dateFormat.parse(date); calendar.setTime(da); int num = calendar.get(Calendar.DAY_OF_WEEK); if (num == 1) { num = 7; } else { num = num - 1; } return num + "";//$NON-NLS-1$ } }