 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Sudesh Guest
|
Posted: Thu Mar 29, 2007 8:10 am Post subject: str to date |
|
|
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
|
Posted: Thu Mar 29, 2007 8:10 am Post subject: Re: str to date |
|
|
ok I got it. VarToDateTime()
Correct?? |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Mar 29, 2007 8:10 am Post subject: Re: str to date |
|
|
"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
|
Posted: Thu Mar 29, 2007 8:10 am Post subject: Re: str to date |
|
|
"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
|
Posted: Thu Mar 29, 2007 10:52 pm Post subject: Re: str to date |
|
|
"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 |
|
 |
|
|
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
|
|