当前位置: 首页>>代码示例>>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;未经允许,请勿转载。