Re: Code to sort out different dates
- From: "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
- Date: Sun, 5 Feb 2006 10:44:25 -0500
This sounds all very complicated to me.
About what I'm trying to do I can say:
I'm searching for a date in a word document.
This date is always in the same place, like for example "DOI: 22
January 2006"
Now I need to grab that date "22 January 2006" from the document in a
string and
make it into a date like "YYYYMMDD". Normally the dates will be
recognized by Format,
but sometimes they use very strange combination.
To get these strange combinations into a proper ISO date I need a
function.
You will need to be able to anticipate the "strange combinations" in order
convert them... there is no built-in way for VB to know a non-standard date
presentation. That means you will have to be able to specify, in code,
interpretations for dates that are "odd" looking. If you can't guess at a
"strange format" beforehand, your code will not be able to decipher it
automatically. Do you think you can list **all** of the "strangely
formatted" dates your program will have to handle for us? If so, we can
design up some code for you.
HOWEVER, and this is a big however, you still need to tell us if the dates
were all typed in originally on computers using the same regional settings
for dates. You HAVE to know this. There is no way of knowing if 04/05/06 is
April 4, 2006 or May 5, 2006 or May 6, 2004 or June 5, 2004, etc. A user can
set up their computer's interpretation of dates in lots of different ways;
and you will need to know how in order to interpret dates that are
"ambiguous". This is a problem with dates in text format... there is no
automatic way to decipher them if you don't know how the original "inputter"
of the date thinks about dates. Their regional date settings should give you
a clue (but even it is not 100% guaranteed if, for example, multiple users
can use your program on the same computer). When your program is running,
are you (or another human) there to monitor it? If so, you could popup a
MessageBox to yourself and ask how you want the program to interpret a date
that is ambiguous.
Rick
.
- Follow-Ups:
- Re: Code to sort out different dates
- From: Rick Rothstein [MVP - Visual Basic]
- Re: Code to sort out different dates
- References:
- Code to sort out different dates
- From: vonclausowitz
- Re: Code to sort out different dates
- From: J French
- Re: Code to sort out different dates
- From: vonclausowitz
- Re: Code to sort out different dates
- From: J French
- Re: Code to sort out different dates
- From: vonclausowitz
- Code to sort out different dates
- Prev by Date: Re: Class as an array
- Next by Date: Re: Code to sort out different dates
- Previous by thread: Re: Code to sort out different dates
- Next by thread: Re: Code to sort out different dates
- Index(es):
Relevant Pages
|