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 

str to date

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Students)
View previous topic :: View next topic  
Author Message
Sudesh
Guest





PostPosted: Thu Mar 29, 2007 8:10 am    Post subject: str to date Reply with quote



Hello,

DateTimeToString(dt_time, "mmm-dd-yy hh:mm:ss", myDateTime);

Now how to get back TDateTime from dt_time in above format?

StrToDateTime() requires MM/DD/YY HH:MM:SS format

Is there any other direct function?

Thanks,
Sudesh
Back to top
Sudesh
Guest





PostPosted: Thu Mar 29, 2007 8:10 am    Post subject: Re: str to date Reply with quote



ok I got it. VarToDateTime()
Correct??
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 29, 2007 8:10 am    Post subject: Re: str to date Reply with quote



"Sudesh" <sudeshc (AT) vfemail (DOT) net> wrote in message
news:460b3af8 (AT) newsgroups (DOT) borland.com...

Quote:
StrToDateTime() requires MM/DD/YY HH:MM:SS format

StrToDateTime() uses the formats that are assigned to the global
date/time formatting variables, such as ShortDateFormat and
ShortTimeFormat.


Gambit
Back to top
Thorsten Kettner
Guest





PostPosted: Thu Mar 29, 2007 8:10 am    Post subject: Re: str to date Reply with quote

"Sudesh" <sudeshc (AT) vfemail (DOT) net> wrote:
Quote:
DateTimeToString(dt_time, "mmm-dd-yy hh:mm:ss", myDateTime);
Now how to get back TDateTime from dt_time in above format?
StrToDateTime() requires MM/DD/YY HH:MM:SS format
Is there any other direct function?

I always wondered why StrToDateTime() takes no format parameter.
This is definitely a design flaw from my point of view.

Quote:
ok I got it. VarToDateTime()
Correct??

Wow, that works even on my German computer! Can anybody explain
why? I had thought that VarToDateTime() would recognize dt_time
being a String and then call StrToDateTime() internally, but it
seems to have a conversion routine of its own, ridiculously
superior to StrToDateTime() when it comes to convert from String
to TDateTime. Or is it just coincidence, "mmm-dd-yy hh:mm:ss"
being one of few formats known to VarToDateTime()?
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 29, 2007 10:52 pm    Post subject: Re: str to date Reply with quote

"Thorsten Kettner" <QUESTIONBYthorsten.kettner (AT) otto (DOT) de> wrote in
message news:460b685a$1 (AT) newsgroups (DOT) borland.com...

Quote:
Wow, that works even on my German computer! Can
anybody explain why?

VarToDateTime() takes a Variant as input. When the Variant holds a
String value, the Win32 API VarDateFromStr() function is called. My
guess would be that Microsoft natively supports more parsing options
then the VCL does.

Quote:
I had thought that VarToDateTime() would recognize
dt_time being a String

It does.

Quote:
and then call StrToDateTime() internally

The Win32 API is used first. Only if it fails, then TryStrToDate() is
called. If that fails, then TryStrToFloat() is called. If that also
fails, then an exception is raised.

Quote:
Or is it just coincidence, "mmm-dd-yy hh:mm:ss"
being one of few formats known to VarToDateTime()?

Possibly. There is no information on that.


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Students) 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.