當前位置: 首頁>>代碼示例>>Java>>正文


Java Date.getDate方法代碼示例

本文整理匯總了Java中java.util.Date.getDate方法的典型用法代碼示例。如果您正苦於以下問題:Java Date.getDate方法的具體用法?Java Date.getDate怎麽用?Java Date.getDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Date的用法示例。


在下文中一共展示了Date.getDate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setTime

import java.util.Date; //導入方法依賴的package包/類
public void setTime(long time) {
    Date d = new Date(time);
    long dtime;
    int year = d.getYear() + 1900;
    if (year < 1980) {
        dtime = (1 << 21) | (1 << 16);
    }
    else {
        dtime = (year - 1980) << 25 | (d.getMonth() + 1) << 21 |
        d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
        d.getSeconds() >> 1;
    }

    modificationDate = (short)(dtime >> 16);
    modificationTime = (short)(dtime & 0xFFFF);
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:17,代碼來源:ZioEntry.java

示例2: get6days

import java.util.Date; //導入方法依賴的package包/類
public static String[] get6days(boolean returnString)
{
    Date d=getToday();


    String [] days=new String[6];
    for (int i=0;i<6;i++)
    {
        Date t=add(d,i-5);
        days[i]=t.getMonth()+1+"."+t.getDate();
    }
    return days;
}
 
開發者ID:gojuukaze,項目名稱:healthgo,代碼行數:14,代碼來源:DateTimeHelper.java

示例3: getNextMonth

import java.util.Date; //導入方法依賴的package包/類
/**
 * 獲取當天的下一個月
 */
public static String getNextMonth() {
    Date t = new Date();
    String nmonth = new String();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    try {
        //t=sdf.parse(now);
        Date nextmonth = new Date((t.getYear() + (t.getMonth() + 1) / 12),
                (t.getMonth() + 1) % 12, t.getDate());
        nmonth = sdf.format(nextmonth.getTime());
    } catch (Exception e) {

        e.printStackTrace();
    }
    return nmonth;
}
 
開發者ID:imliujun,項目名稱:LJFramework,代碼行數:20,代碼來源:TimeUtils.java

示例4: getView

import java.util.Date; //導入方法依賴的package包/類
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    Date date = getItem(position);
    if (convertView == null) {
        convertView = layoutInflate.inflate(R.layout.calendar_day_item, parent, false);
    }
    int day = date.getDate();
    ((TextView) convertView).setText(String.valueOf(day));
    boolean isTheSameMonth = false;
    if (date.getMonth() == selectedDate.getMonth()) {
        isTheSameMonth = true;
    }
    if (isTheSameMonth) {
        ((CalendarDayTextView) convertView).setTextColor(Color.parseColor("#000000"));
    } else {
        ((CalendarDayTextView) convertView).setTextColor(Color.parseColor("#666666"));
    }
    //判斷當前日期是否是已簽到的日期
    if (daySet.size()>0  && daySet.contains(((TextView) convertView).getText()) && isTheSameMonth) {
        ((CalendarDayTextView) convertView).isSelected = true;
    }
    return convertView;
}
 
開發者ID:codekongs,項目名稱:ImageClassify,代碼行數:25,代碼來源:CalendarView.java

示例5: setDate

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public void setDate(Date date) {
    int dayOfMonth = date.getDate();
    if (monthNameVisible) {
        caption.setText(dayOfMonth + " " + calendar.getMonthNames()[date.getMonth()]);
    } else {
        caption.setText("" + dayOfMonth);
    }

    if (dayOfMonth == 1) {
        addStyleName("firstDay");
    } else {
        removeStyleName("firstDay");
    }

    this.date = date;
}
 
開發者ID:blackbluegl,項目名稱:calendar-component,代碼行數:18,代碼來源:SimpleDayCell.java

示例6: isToday

import java.util.Date; //導入方法依賴的package包/類
public static boolean isToday(Date date) {
    Date now = new Date();
    boolean result = true;
    result &= date.getYear() == now.getYear();
    result &= date.getMonth() == now.getMonth();
    result &= date.getDate() == now.getDate();
    return result;
}
 
開發者ID:ZHENFENG13,項目名稱:My-Blog,代碼行數:9,代碼來源:DateKit.java

示例7: feature

import java.util.Date; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
public double[] feature(Date date) {
    double[] x = new double[types.length];
    for (int i = 0; i < types.length; i++)
    switch (types[i]) {
        case YEAR:
            x[i] = 1900 + date.getYear();
            break;
        case MONTH:
            x[i] = date.getMonth();
            break;
        case DAY_OF_MONTH:
            x[i] = date.getDate();
            break;
        case DAY_OF_WEEK:
            x[i] = date.getDay();
            break;
        case HOURS:
            x[i] = date.getHours();
            break;
        case MINUTES:
            x[i] = date.getMinutes();
            break;
        case SECONDS:
            x[i] = date.getSeconds();
            break;
        default:
            throw new IllegalStateException("Unknown date feature type: " + types[i]);
    }
    return x;
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:33,代碼來源:DateFeature.java

示例8: get6days

import java.util.Date; //導入方法依賴的package包/類
public static String[] get6days(boolean returnString)
{
    Date d=getToday();

    String [] days=new String[6];
    for (int i=0;i<6;i++)
    {
        Date t=add(d,i-2);
        days[i]=t.getMonth()+1+"."+t.getDate();
    }
    return days;
}
 
開發者ID:gojuukaze,項目名稱:healthgo,代碼行數:13,代碼來源:WeatherChartView.java

示例9: main

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static void main(String args[])
{
    GregorianCalendar cal = new GregorianCalendar();
    cal.set(Calendar.YEAR, 1997);
    cal.set(Calendar.DAY_OF_YEAR, 1);
    Date d = cal.getTime();             // Should be Jan 1
    if (d.getMonth() != 0 || d.getDate() != 1) {
        throw new RuntimeException("Date isn't Jan 1");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:bug4100311.java

示例10: initSimulatorName

import java.util.Date; //導入方法依賴的package包/類
private void initSimulatorName(){
	Date d = new Date();
	ParameterizedPaySim.simulatorName = "PS_" + (d.getYear() + 1900) + (d.getMonth() + 1)  + d.getDate() + d.getHours() + d.getMinutes()
			+ d.getSeconds() + "_" + this.seed;
	//System.out.println(simulatorName + "\n");
	File f = new File(System.getProperty("user.dir")  +"//outputs//" + ParameterizedPaySim.simulatorName);
	f.mkdir();
}
 
開發者ID:EdgarLopezPhD,項目名稱:PaySim,代碼行數:9,代碼來源:ParameterizedPaySim.java

示例11: javaToDosTime

import java.util.Date; //導入方法依賴的package包/類
public static long javaToDosTime(long time) {
    Date d = new Date(time);
    int year = d.getYear() + 1900;
    if (year < 1980) {
        return (1 << 21) | (1 << 16);
    }
    return (year - 1980) << 25 | (d.getMonth() + 1) << 21 |
           d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
           d.getSeconds() >> 1;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:ZipUtils.java

示例12: javaToDosTime

import java.util.Date; //導入方法依賴的package包/類
/**
 * Converts Java time to DOS time.
 */
@SuppressWarnings("deprecation") // Use of date methods
private static long javaToDosTime(long time) {
    Date d = new Date(time);
    int year = d.getYear() + 1900;
    if (year < 1980) {
        return ZipEntry.DOSTIME_BEFORE_1980;
    }
    return (year - 1980) << 25 | (d.getMonth() + 1) << 21 |
           d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
           d.getSeconds() >> 1;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:ZipUtils.java

示例13: isToday

import java.util.Date; //導入方法依賴的package包/類
/**
 * 測試是否是當天
 * 
 * @param date
 *            某一日期
 * @return true 今天, false-不是
 */
@SuppressWarnings("deprecation")
public static boolean isToday(Date date) {

    Date now = new Date();
    boolean result = true;
    result &= date.getYear() == now.getYear();
    result &= date.getMonth() == now.getMonth();
    result &= date.getDate() == now.getDate();
    return result;
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:18,代碼來源:DateTimeHelper.java

示例14: calculateStartFromMinute

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private long calculateStartFromMinute(long startFromMinutes, Date from,
        Date to, int dayOffset) {
    boolean eventStartAtDifferentDay = from.getDate() != to.getDate();
    if (eventStartAtDifferentDay) {
        long minutesOnPrevDay = (getTargetDateByCurrentPosition(dayOffset)
                .getTime() - from.getTime()) / DateConstants.MINUTEINMILLIS;
        startFromMinutes = -1 * minutesOnPrevDay;
    }

    return startFromMinutes;
}
 
開發者ID:blackbluegl,項目名稱:calendar-component,代碼行數:13,代碼來源:DateCellDayItem.java

示例15: getToday

import java.util.Date; //導入方法依賴的package包/類
public static Date getToday()
{
    Date d=new Date();
    return new Date(d.getYear(),d.getMonth(),d.getDate());
}
 
開發者ID:gojuukaze,項目名稱:healthgo,代碼行數:6,代碼來源:DateTimeHelper.java


注:本文中的java.util.Date.getDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。