Title: Text to Date

Terry,

 

I started to play with your “basic” code and I soon found that it was not that easy if one assumes that input dates are not perfect and if one considers format variations. I ended up my morning with a small application that converts one date at the time but allows for defining the separator and choosing between 3 date structures and numeric or 3 letter month definitions. You will find that application at www.pc-gis.com/download.htm at the bottom of the beta section

 

I wish you and other interested have a look at that small thing and let me know of any problem you encounter or of any improvement you can think of, particularly in the area of date structures and spelling variations (2 char to full name) in any acceptable language.

 

I would also like indications on possible use in an “automatic” setting (such as updating a column) to design a production tool, but as soon as I consider the conversion functions stabilized (it all depends on you) I will make them available for reuse in your programs,

 

Thank you

 

Jacques Paris

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Terry McDonnell
Sent: 28 avril 2006
05:33
To: Llewellyn, David; [EMAIL PROTECTED]
Subject: RE: [MI-L] Text to Date

 

David

 

Unless anyone knows of a ready-made func for this, I guess you'll have to write your own.  Assuming your date string will always be of the form dd Mmm yyyy:

 

Function ConvStrToDate( tcDateString as String) as Date

'_____________________

Dim lcDay, lcMonth, lcYear, lcDate as String

 

lcDay            = LEFT$( tcDateString, 2)

lcMonth          = UCase$( MID$( tcDateString, 4, 3))

Do Case

  Case lcMonth = "JAN"

    lcMonth      = "01"

  Case lcMonth = "FEB"

    lcMonth      = "02"

  ...

EndCAse

lcYear           = RIGHT$( tcDateString, 4)

lcDate           = lcDay + "/" + lcMonth + "/" + lcYear

ConvStrToDate    = StringToDate( lcDate)

End Func

 

..or I'll write it for you! :-)

 

HTH

Regards

 

Terry McDonnell

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Llewellyn, David
Sent: 28 April 2006 05:58
To: Terry McDonnell
Subject: [MI-L] Text to Date

Dear List,

Does anyone know a good way to convert text of the form:

“15 Aug 1821”

to a date in a Date type column in MapInfo?

Thanks

David Llewellyn

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to