yy1717
2020-09-18 03a05501800d2c02bca1c05ca6f7080d715aba23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.safeluck.aykj.decoder;
 
import com.safeluck.aykj.utils.BitState;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
 
/**
 * Created by zw on 2017/6/15.
 */
 
public class BcdDateCoder extends BaseDecoder<Date>  {
    SimpleDateFormat f= new SimpleDateFormat("yyMMdd");
    @Override
    public Date decode(String date) {
        try {
            return f.parse(date);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
 
    @Override
    public String encode(Date date) {
        return f.format(date);
    }
}