Bonjour à tous,
Est-ce-qu'il y aurait des personnes qui maitrisent et c# et java?
Je suis débutant, et j'ai un code que je n'arrive pas à adapter...
Si quelqu'un a de l'expérience java, ça me serait très utile.
---------------------------------DEBUT BOUT DE CODE----------------------
if (type.equals("&Time")){
long tempTime = 0;
for (int i=0; i<size;++i){
tempTime = tempTime * 256 + iResult[size-1-i];
}
Calendar ca = Calendar.getInstance();
// Set temporal Origin
//30 December 1899, midnight 0.00
ca.set(1899,11,30,0,0,0);
// Add Days
double shift = Double.longBitsToDouble(tempTime);
int iShift = (int) shift;
ca.add(Calendar.DAY_OF_YEAR, iShift);
// Hours
double hours = (shift-iShift)*24;
int iHours = (int)hours;
ca.add(Calendar.HOUR, iHours);
// Minutes
double minutes = (hours-iHours)*60;
int iMinutes = (int) minutes;
ca.add(Calendar.MINUTE, iMinutes);
// Seconds
double seconds = (minutes-iMinutes)*60;
int iSeconds = (int) Math.round(seconds);
ca.add(Calendar.SECOND, iSeconds);
Date date = ca.getTime() ;
String month = formatInt(ca.get(Calendar.MONTH)+1);
String day = formatInt(ca.get(Calendar.DAY_OF_MONTH));
String fHours = formatInt(ca.get(Calendar.HOUR_OF_DAY));
String fMinutes = formatInt(ca.get(Calendar.MINUTE));
String fSeconds = formatInt(ca.get(Calendar.SECOND));
value = Integer.toString(ca.get(Calendar.YEAR))+"/"+month+"/"+day+" "+fHours+":"+fMinutes+":"+fSeconds;
}
return value;
---------------------------------FIN BOUT DE CODE----------------------
C'est surtout la partie calendar (DateTime en C#) que je n'arrive pas à bien implémenter.
Merci d'avance.
PS:Je rappelle que je suis un débutant, donc ayez pitié de moi![]()
Partager