Here you can find the source of getCalendarField(char c)
public static int getCalendarField(char c)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Oobium, Inc./* w ww . j a va 2 s. c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Jeremy Dowdall <jeremy@oobium.com> - initial API and implementation ******************************************************************************/ import java.util.Calendar; public class Main { public static int getCalendarField(char c) { switch (c) { case 'y': return Calendar.YEAR; case 'M': return Calendar.MONTH; case 'D': return Calendar.DAY_OF_YEAR; case 'd': return Calendar.DAY_OF_MONTH; case 'H': return Calendar.HOUR_OF_DAY; case 'k': return Calendar.HOUR_OF_DAY; case 'h': return Calendar.HOUR; case 'K': return Calendar.HOUR; case 'm': return Calendar.MINUTE; case 's': return Calendar.SECOND; case 'S': return Calendar.MILLISECOND; case 'a': return Calendar.AM_PM; default: return -1; } } }