Title: Message
Depends on how much trouble you need to go to.
 
If it always has to be correct - and break rather than fail silently, you'll need Myles' 200+ lines.
 
If you are after very quick and dirty, there is a varAsDateTime function,
and for something in the middle StrToDateTime.
 
Note that StrToDateTime can't handle  '11/1/04' - depending on system
settings it'll silently be converted to one of 11 jan or 1 Nov.
And it uses - I think - ShortDateFormat which I can never remember what its set to -
so it will return an error for some formats even though the date'd be correct in other
formats.
 
Note also, that that 200 + lines is *very* hard to do well  ( its reasonably straight
forward coding, but be prepared to spend the next x years finding weird cases that
don't get handled correctly).  (Is that your experience Myles?)
 
Cheers, Kurt.
-----Original Message-----
From: Myles Penlington [mailto:[EMAIL PROTECTED]
Sent: Friday, 18 June 2004 12:10 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Date conversions

Ah, no.
Several lines of code. eg have about 200+ lines for converting dates (and times) of any format into a TDatetime.
The standard VCL routines (and the Win32 API) are just not good enough.
 
Myles.
-----Original Message-----
From: David O'Brien [mailto:[EMAIL PROTECTED]
Sent: Friday, 18 June 2004 12:08
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Date conversions

Hi all,

 

Is there any easy way of converting a date string into a TDate?

 

i.e. “Fri, 18 Jun, 2004”

 

Dave.

This electronic message together with any attachments is confidential and intended for the named recipient's use only. If you are not the intended recipient (i) do not copy, disclose or use the contents in any way, (ii) please let us know by return email immediately then destroy the message, and any hard copies of the message, and any attachments. The sender of this message is not responsible for any changes made to this message and/or any attachments and/or connection linkages to the Internet after it has been sent. Unless otherwise stated, any pricing information given in this message and/or attachments is indicative only, is subject to change and does not constitute an offer to buy or sell securities or derivatives at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to separate formal written notification. Where reference is made to research material and/or research recommendations, the basis of the provision of such research material and/or recommendations is set out in the relevant disclaimer.
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to