Here you can find the source of getYesterday6AM()
public static String getYesterday6AM()
//package com.java2s; /******************************************************************************* * Copyright 2014 Miami-Dade County// w w w . j a va 2 s. com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getYesterday6AM() { Calendar today = Calendar.getInstance(); today.add(Calendar.DATE, -1); today.set(Calendar.HOUR, 6); today.set(Calendar.AM_PM, Calendar.AM); today.set(Calendar.MINUTE, 02); today.set(Calendar.SECOND, 0); today.set(Calendar.MILLISECOND, 0); SimpleDateFormat outgoingFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); return outgoingFormat.format(today.getTime()); } }