I have this method which converts Persian date to gregoian date and saves in the mssql db. the data is now saved like this in the table col 2014-01-14 00:00:00.
How can I save the date without the time i.e. I just want to save this 2014-01-14
@SuppressWarnings("deprecation") public static Date jalaliToGregorian(String nowDate) { try{ GWTPersianCalendar pcal1 = new GWTPersianCalendar(); pcal1.parsePersianDate(nowDate); return new Date(pcal1.getTime()); } catch (Exception e) { return new Date(nowDate); } }
Here http://technet.microsoft.com/en-us/library/ms186724.aspx are the date and time datatypes available in Microsoft SQL Server. "hibernate hbm file" means nothing to me and it does not look like it is what defines the columns in an SQL Server Database. Is it 'your' database so you can have the columns re-defined?
It looks like you are using the method getTime() from the GWTPersianCalendar class to return your conversion value. What datatype is that and what other methods might it have (such as getDate)?
Zolf
ASKER
by: awking00
thanks for your feedback. this is the getTime() method of GWTPersianCalendar class.that is the only method it has.
@Override
public long getTime() {
// TODO Remove timeZoneoffset like /*- (getTimezoneOffset()*60000) */
return super.getTime();
}
I am using Microsoft SQL Server 2008