BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

string to date sql server 2000

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
ganesh
Guest





PostPosted: Thu Dec 11, 2003 11:57 am    Post subject: string to date sql server 2000 Reply with quote




I've a string ddmmyyyy, how can i convert into date format to store it in database

thanks
Back to top
Mehrdad Momeni
Guest





PostPosted: Thu Dec 11, 2003 1:29 pm    Post subject: Re: string to date sql server 2000 Reply with quote




"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





PostPosted: Thu Dec 11, 2003 1:48 pm    Post subject: Re: string to date sql server 2000 Reply with 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:
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





PostPosted: Thu Dec 11, 2003 1:50 pm    Post subject: Re: string to date sql server 2000 Reply with 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...
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





PostPosted: Thu Dec 11, 2003 7:27 pm    Post subject: Re: string to date sql server 2000 Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.