When a user select a date/time, I need to store it in the DB as a timestamp. I would like to parse the string (date/time) to timestamp (if it is the best approach). However, I cannot figure it out!
Here's what I have so far:
Java
protected String startDate
@Column(name="start_date")
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
@Override
public boolean equals(Object obj) {
if (startDate == null) {
if (other.startDate != null)
return false;
} else if (!startDate.equals(other.startDate))
return false;
}
JS
// date picker
$('.datepicker').datetimepicker({
controlType: 'select',
dateFormat: 'M d, yy',
timeFormat: 'h:m:s TT'
});
HTML
<input id="project_start_date" class="datepicker" type="text" name="project.startDate" value="${project.startDate}"/>
Thank you in advance!