我有以下查询:
select cast(max_bid_ts as TIMESTAMP) from my_table;
Run Code Online (Sandbox Code Playgroud)
我投了max_bid_ts因为是双打,我想成为一个TMESTAMP。该查询返回类似这样的内容
2016-04-21 12:41:46.313999872
Run Code Online (Sandbox Code Playgroud)
我只想要小时:分钟:秒部分。在这种情况下将是12:41:46。最好的方法是什么?
//我一直试图理解字符串如何工作以及它的主要功能是什么,但我遇到了麻烦.喜欢以下examaple.toString方法究竟做了什么?
public class Item {
private String name;
private int price;
private int qty;
public Item() {
}
public Item(String n, int p, int q){
this.name=n;
this.price=p;
this.qty=q;
}
public String getName() {
return name;
}
public int getPrice() {
return price;
}
public int getQty() {
return qty;
}
public String toString() {
return name +": $" + price+":" + qty;
}
Run Code Online (Sandbox Code Playgroud)