Here you can find the source of dosToJavaTme(int dosTime)
Parameter | Description |
---|---|
dosTime | a parameter |
public static long dosToJavaTme(int dosTime)
//package com.java2s; /*//w w w .j a v a 2 s . c om * Copyright 2010 Srikanth Reddy Lingala * * 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.util.Calendar; public class Main { /** * Converts time in dos format to Java format * @param dosTime * @return time in java format */ public static long dosToJavaTme(int dosTime) { int sec = 2 * (dosTime & 0x1f); int min = (dosTime >> 5) & 0x3f; int hrs = (dosTime >> 11) & 0x1f; int day = (dosTime >> 16) & 0x1f; int mon = ((dosTime >> 21) & 0xf) - 1; int year = ((dosTime >> 25) & 0x7f) + 1980; Calendar cal = Calendar.getInstance(); cal.set(year, mon, day, hrs, min, sec); cal.set(Calendar.MILLISECOND, 0); return cal.getTime().getTime(); } }