title: how to convert datetime to timestamp in java
body: <p>forum member</p>
  
  <p>I am having one problem with date time in java. Actually I am receiving the <strong>startdate in format 2012-02-27T01:10:10</strong> and I want to insert the received date to my database having datetime datatype.</p>
  
  <p>Actually I tried to convert the startdate received to datetime by below code</p>
  
  <pre><code>String sDate = jsonObject.get("StartDate").toString();
  String eDate = jsonObject.get("EndDate").toString();
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
  Date startD = sdf.format(sDate);
  Date endD = sdf.format(eDate);
  </code></pre>
  
  <p>but with the above code only <strong>date gets added to my database like 2012-02-27 00:00:00</strong></p>
  
  <p>I want to add the time also to my database but when I change the SimpleDateFormat to SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  nothing works.</p>
  
  <p>please suggest me some solution I can apply so my time also gets added to database. I am using Hibernate JPA as my persistence layer.</p>