Page 1 of 1
How i cast a date field in update or insert
Posted: Thu Apr 07, 2016 10:16 pm
by paolcon
Hi, please somebody can help me?
I use Sybase in ODBC, my dateformat in Italy is dd/mm/yyyy,
when i try to do an Rowupdate of a datefield in db with the date by another table, the db send a message like:
" 12/03/2016 12:21 INVALID TIMESTAMP FORMAT"
How i can CAST the dataformat In Row_UPDATE?
Tnks
Re: How i cast e date field in update or insert
Posted: Fri Apr 08, 2016 10:41 am
by motfs
paolcon wrote:
I use Sybase in ODBC
Not sure about this database. You may use ew_UnFormatDateTime(object ADate, int ANamedFormat) function to unformat the date. Search this function in aspxfn*.cs to find out more details about the time format.
Re: How i cast e date field in update or insert
Posted: Wed Apr 13, 2016 12:02 am
by paolcon
Thanks, i solved in this way
plandate id dd/mm/yy 00:00:00
String dataplanned= "convert (datetime, substring ('"+rsnew["plandate"]+"', 7,4) + '-' + substring ('"+rsnew["plandate"]+"', 4,2) + '-'+ substring ('"+rsnew["plandate"]+"', 1,2)+ ' ' + substring ('"+rsnew["plandate"]+"', 12,8),120)";
dataplanned now is timestamp comatible