 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ganesh Guest
|
Posted: Thu Dec 11, 2003 11:57 am Post subject: string to date sql server 2000 |
|
|
I've a string ddmmyyyy, how can i convert into date format to store it in database
thanks
|
|
| Back to top |
|
 |
Mehrdad Momeni Guest
|
Posted: Thu Dec 11, 2003 1:29 pm Post subject: Re: string to date sql server 2000 |
|
|
"ganesh" wrote
| Quote: | I've a string ddmmyyyy, how can i convert into date format to store it in
database
thanks
|
Hi
You can you FormatDateTime
|
|
| Back to top |
|
 |
ganesh Guest
|
Posted: Thu Dec 11, 2003 1:48 pm Post subject: Re: string to date sql server 2000 |
|
|
thanks,
but i wanted to do it from sql server not from delhi, there also i can do substring, but just want to know any single sql function can do this
"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote:
| Quote: | var
d, m, y: Word;
begin
d := StrToInt(Copy(strDate, 1, 2));
m := StrToInt(Copy(strDate, 3, 2));
y := StrToInt(Copy(strDate, 5, 4));
Result := EncodeData(y, m, d);
end;
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"ganesh" <gsganesh (AT) yahoo (DOT) com> сообщил/сообщила в новостях следующее:
news:3fd869c4$1 (AT) newsgroups (DOT) borland.com...
I've a string ddmmyyyy, how can i convert into date format to store it in
database
thanks
|
|
|
| Back to top |
|
 |
Viatcheslav V. Vassiliev Guest
|
Posted: Thu Dec 11, 2003 1:50 pm Post subject: Re: string to date sql server 2000 |
|
|
var
d, m, y: Word;
begin
d := StrToInt(Copy(strDate, 1, 2));
m := StrToInt(Copy(strDate, 3, 2));
y := StrToInt(Copy(strDate, 5, 4));
Result := EncodeData(y, m, d);
end;
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"ganesh" <gsganesh (AT) yahoo (DOT) com> сообщил/сообщила в новостях следующее:
news:3fd869c4$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
I've a string ddmmyyyy, how can i convert into date format to store it in
database
thanks
|
|
|
| Back to top |
|
 |
Viatcheslav V. Vassiliev Guest
|
Posted: Thu Dec 11, 2003 7:27 pm Post subject: Re: string to date sql server 2000 |
|
|
SELECT CONVERT (DATETIME, '20031201', 112)
Look for CONVERT in BOL for more info. Format ddmmyyyy seems to be not
supported by yyyymmdd and dd.mm.yy
are.//------------------------------------------Regards,Vassiliev V.
V.http://www.managed-vcl.com - using .Net objects in Delphi +
ADO.Nethttp://www.oledbdirect.com - The fastest way to access MS SQL
Server,MS Jet (Access) and Interbase (through OLEDB)"ganesh"
<gsganesh (AT) yahoo (DOT) com> сообщил/сообщила в новостях следующее:
news:3fd883da$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
thanks,
but i wanted to do it from sql server not from delhi, there also i can do
substring, but just want to know any single sql function can do this
"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote:
var
d, m, y: Word;
begin
d := StrToInt(Copy(strDate, 1, 2));
m := StrToInt(Copy(strDate, 3, 2));
y := StrToInt(Copy(strDate, 5, 4));
Result := EncodeData(y, m, d);
end;
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"ganesh" <gsganesh (AT) yahoo (DOT) com> сообщил/сообщила в новостях следующее:
news:3fd869c4$1 (AT) newsgroups (DOT) borland.com...
I've a string ddmmyyyy, how can i convert into date format to store it
in
database
thanks
|
|
|
| Back to top |
|
 |
|
|
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 You cannot vote in polls in this forum
|
|