无法仅获取Timestamp的日期部分并将其与java.sql.Date对象进行比较

时间:2016-10-03 08:12:14

标签: postgresql scala slick

我想比较一下

query filter {
  _._1.asOf === // how to compare it with date part only?
}

此处_._1.asOf的类型为Rep[java.sql.Timestamp]。我想要做的是仅将此时间戳的日期部分与java.sql.Date.valueOf(dateString)进行比较。

1 个答案:

答案 0 :(得分:0)

if (txtNodeName.Text==String.Empty) { MessageBox.Show("Please enter the Node Name in Textbox"); txtNodeName.Focus(); } else { string n = txtNodeName.Text; if (treeView1.SelectedNode == null) { treeView1.Nodes.Add(n, n); } else { treeView1.SelectedNode.Nodes.Add(n, n); } } } BinaryFormatter bf = new BinaryFormatter(); int i=1; private void btnSerialize_Click(object sender, EventArgs e) //serialization is done here { i = 1; Stream file = File.Create(filename); ArrayList ar = new ArrayList(); foreach (TreeNode tn in treeView1.Nodes) { ar.Add(tn); //conver tree to arraylist } bf.Serialize(file, ar); file.Close(); } private void btnDeserialize_Click(object sender, EventArgs e) //deserialization is done here { if (i == 1) { treeView1.Nodes.Clear(); Stream file = File.Open(filename, FileMode.Open); TreeNode tr = null; object obj = null; try { obj = bf.Deserialize(file); } catch (Exception ex) { MessageBox.Show(ex.Message); } ArrayList ar = obj as ArrayList; foreach (TreeNode tl in ar) { if (tr == tl) tr = tl; treeView1.Nodes.Add(tl); } file.Close(); i++; java.util.Timestamp的子类型,因此您可以使用java.util.DategetDategetMonth,然后将其值与输出值进行比较getYear使用相同的getter。

主动提醒你,Jodatime库在jvm上处理DateTime时,你可以使用这个:https://github.com/tototoshi/slick-joda-mapper作为sql timestamp和jodatime的mapper。