-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Comparing a timestamp date with a string date
PostPosted: Thu Sep 15, 2005 8:52 am 
Newbie

Joined: Tue Aug 02, 2005 10:36 pm
Posts: 5
Hi all,


I've the following code:


Query query = dbSession.createQuery("from Job as job where job.dateCollected >= :dateStart");

query.setTimestamp("dateStart", DateTimeUtil.parse((String) request.getParameter("dateStart")).toDate());

It works fine if the dateCollected field is a Date Object in my Job class
Due to unforseen stuff, dateCollected has to be changed to a String Object.

How should i change the query?

The dateStart parameter is gotten from a text field in ddMMyyyy format (eg:15092005).

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 2:38 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
The easied fix I could see would be store the date in yyyyMMdd that way the higher string is the later date and just present in what ever format you want.

You can then set date start when you compare it to be a string in that format with simpledateformater.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.