- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
private String getNullString(int kol){
String nullstr="";
for(int i=0;i<kol;i++){
nullstr+="0";
}
return nullstr;
}
public String getNumber(int idd){
String regid="";
String idds=(idd+"");
if(idds.length()<getNumberLenth()){
regid+=getNullString(getNumberLenth()-idds.length());
regid+=idds;
}
String regnum="";
regnum+=getNumberPrefix()+regid;
if(getNumberPeriod()!=NUM_PERIOD_NOPERIOD){
GregorianCalendar c=new GregorianCalendar();
switch(getNumberPeriod()){
case NUM_PERIOD_MONTH:
int m=c.get(Calendar.MONTH)+1;
regnum+="-"+m;
regnum+=".";
regnum+=c.get(Calendar.YEAR);
break;
case NUM_PERIOD_YEAR:
regnum+="-"+c.get(Calendar.YEAR);
}
}
return regnum;
}
maxt 01.04.2010 08:52 # −0.2
public String getNumber(int idd) {
GregorianCalendar gk = new GregorianCalendar();
int year = gk.get(GregorianCalendar.YEAR);
int month = gk.get(GregorianCalendar.MONTH);
switch (getNumberPeriod()) {
case NUM_PERIOD_MONTH:
return String.format("%s%0" + getNumberLenth() + "d-%02d.%d", getNumberPrefix(), idd, month, year);
case NUM_PERIOD_YEAR:
return String.format("%s%0" + getNumberLenth() + "d-%d", getNumberPrefix(), idd, year);
case NUM_PERIOD_NOPERIOD:
return String.format("%s%0" + getNumberLenth() + "d", getNumberPrefix(), idd);
default:
return String.format("%s%0" + getNumberLenth() + "d", getNumberPrefix(), idd);
}
guest 01.04.2010 08:53 # +1.4
guest 01.04.2010 11:01 # +3.2
guest 02.04.2010 13:16 # +0.6