date转timestamp格式 oracle中date类型怎么转换成timestamp类型?

oracle中date类型怎么转换成timestamp类型?1. 将日期类型转换为字符串类型:simpledateformat SDF=new simpledateformat(“yyyy-MM-DD

oracle中date类型怎么转换成timestamp类型?

1. 将日期类型转换为字符串类型:

simpledateformat SDF=new simpledateformat(“yyyy-MM-DD HH:MM:SS”)

simpledateformat SDF1=new simpledateformat(“yyyymmdd”)

string str=sdf.format格式(日期1)

字符串str1=sdf1.format(日期1)系统输出打印(str)系统输出打印(str1)

注意:SDF和SDF1是只有两个你不懂的格式化类型的定义。类型可以自由定义

2。字符串到时间戳类型转换:

1。字符串到时间戳类型:

字符串str3=“2011-02-02 12:12:12”Timestamp.valueOf(str3)系统输出打印( Timestamp.valueOf(str3))