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


Java Date.getSeconds方法代碼示例

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


在下文中一共展示了Date.getSeconds方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: isEqual

import java.util.Date; //導入方法依賴的package包/類
/**
 * @todo have to solve the milli second problem that which is there.!!
 * @param convDate
 * @param expectedDate
 * @return
 */
@SuppressWarnings("deprecation")
protected static boolean isEqual(Date convDate, Date expectedDate)
{
  GregorianCalendar convGcal = new GregorianCalendar();
  convGcal.setTime(convDate);

  GregorianCalendar expGcal = new GregorianCalendar();
  expGcal.setTime(expectedDate);

  // -= Simon Lessard =-
  // FIXME: Switch to Calendar methods
  return
    (convDate.getSeconds() == expectedDate.getSeconds()) &&
    (convDate.getYear()    == expectedDate.getYear())    &&
    (convDate.getMonth()   == expectedDate.getMonth())   &&
    (convDate.getDate()    == expectedDate.getDate())    &&
    (convDate.getHours()   == expectedDate.getHours())   &&
    (convDate.getMinutes() == expectedDate.getMinutes()) ;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:DateTimeConverterTestCase.java

示例3: 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

示例4: 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:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:ZipUtils.java

示例5: javaToDosTime

import java.util.Date; //導入方法依賴的package包/類
/**
 * Converts Java time to DOS time.
 */
@SuppressWarnings("deprecation") // Use of date methods
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:SunburstApps,項目名稱:OpenJSharp,代碼行數:15,代碼來源:ZipUtils.java

示例6: 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

示例7: 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

示例8:

import java.util.Date; //導入方法依賴的package包/類
public static Integer 秒鍾(Date $時間) {
		return $時間.getSeconds();
}
 
開發者ID:MikaGuraN,項目名稱:HL4A,代碼行數:4,代碼來源:時間工具.java

示例9: toRPCDateTime

import java.util.Date; //導入方法依賴的package包/類
public static CalDate toRPCDateTime(Date date) {
    return new CalDate(date.getYear() + 1900, date.getMonth() + 1, date.getDate(),
            new CalTime(date.getHours(), date.getMinutes(), date.getSeconds()));
}
 
開發者ID:blackbluegl,項目名稱:calendar-component,代碼行數:5,代碼來源:DateConstants.java

示例10: startMusicPlay

import java.util.Date; //導入方法依賴的package包/類
protected void startMusicPlay(UpnpClient upnpClient,
		Device<?, ?, ?> device, boolean background, String instanceId) {
	ContentDirectoryBrowseResult browseResult;
	browseResult = upnpClient.browseSync(device, instanceId);
	List<Item> items = browseResult.getResult().getItems();
	for (Item item : items) {

		Log.d(getClass().getName(), "ParentId: " + item.getParentID());
		Log.d(getClass().getName(), "ItemId: " + item.getId());
		Res resource = item.getFirstResource();
		if (resource == null)
			break;
		Log.d(getClass().getName(), "ImportUri: " + resource.getImportUri());
		Log.d(getClass().getName(), "Duration: " + resource.getDuration());
		Log.d(getClass().getName(),
				"ProtocolInfo: " + resource.getProtocolInfo());
		Log.d(getClass().getName(), "ContentFormat: "
				+ resource.getProtocolInfo().getContentFormat());
		Log.d(getClass().getName(), "Value: " + resource.getValue());
		SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss");

		// just for a test
		int millis = 0;
		try {
			Date date = dateFormat.parse(resource.getDuration());
			millis = date.getHours() * 60 * 60 * 1000;
			millis += date.getMinutes() * 60 * 1000;
			millis += date.getSeconds() * 1000;
			assertEquals(date.getTime(), millis);
			Log.d(getClass().getName(),
					"HappyHappy Joy Joy Duration in Millis=" + millis);
			Log.d(getClass().getName(), "Playing: " + item.getTitle());
			if (background) {
				Log.d(getClass().getName(),
						"Starting Background service... ");
				Intent svc = new Intent(getContext(),
						BackgroundMusicService.class);
				svc.setData(Uri.parse(resource.getValue()));
				getContext().startService(svc);
			} else {
				intentView(resource.getProtocolInfo().getContentFormat(),
						Uri.parse(resource.getValue()));
			}
		} catch (ParseException e) {
			Log.d(getClass().getName(), "bad duration format");
			;
		}
		myWait(millis);

	}
}
 
開發者ID:theopenbit,項目名稱:yaacc-code,代碼行數:52,代碼來源:UpnpClientTest.java

示例11: convertToSecond

import java.util.Date; //導入方法依賴的package包/類
/**
 * 將毫秒轉換成秒
 *
 * @param time
 * @return
 */
public static int convertToSecond(Long time) {
    Date date = new Date();
    date.setTime(time);
    return date.getSeconds();
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:12,代碼來源:TimeUtil.java


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