How i cast a date field in update or insert

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
paolcon
User
Posts: 15

How i cast a date field in update or insert

Post 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


motfs
User
Posts: 258

Post 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.


paolcon
User
Posts: 15

Post 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


Post Reply