Discussion:
vb6 and iso 8601 date format
(too old to reply)
Andy Fish
2006-03-21 17:06:11 UTC
Permalink
Hi,

I'm using the soap toolkit version 3 from VB6 and because I have complex
types in the API, I'm using the IXMLDOMNodeList interface.

However, it seems that this means I have to do my own date formatting and
parsing.

anyone know of any free source code in vb6 to convert between the vb6 date
type and ISO8601? Obviously converting vb->iso is easy, but parsing is a bit
more tricky

TIA

Andy
Tony Proctor
2006-03-21 18:08:51 UTC
Permalink
VB accepts some variations of the ISO date format Andy, as does SQL. For
instance

Debug.print CDate("2006-11-30")

correctly yields 30-nov-2006. If you mean the ISO variation without the
separators then inserting them first shouldn't be too difficult since the
offsets are fixed.

Going the other way is pretty easy too:

Debug.Print Format$(#30-nov-2006#, "yyyy-mm-dd")


Tony Proctor
Post by Andy Fish
Hi,
I'm using the soap toolkit version 3 from VB6 and because I have complex
types in the API, I'm using the IXMLDOMNodeList interface.
However, it seems that this means I have to do my own date formatting and
parsing.
anyone know of any free source code in vb6 to convert between the vb6 date
type and ISO8601? Obviously converting vb->iso is easy, but parsing is a bit
more tricky
TIA
Andy
Bob Butler
2006-03-21 20:49:04 UTC
Permalink
Post by Tony Proctor
VB accepts some variations of the ISO date format Andy, as does SQL.
For instance
Debug.print CDate("2006-11-30")
correctly yields 30-nov-2006. If you mean the ISO variation without
the separators then inserting them first shouldn't be too difficult
since the offsets are fixed.
Debug.Print Format$(#30-nov-2006#, "yyyy-mm-dd")
Post by Andy Fish
anyone know of any free source code in vb6 to convert between the
vb6 date type and ISO8601? Obviously converting vb->iso is easy, but
parsing is a bit more tricky
The DateSerial and TimeSerial functions are also useful when parsing dates
in fixed string formats
--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Andy Fish
2006-03-22 10:02:14 UTC
Permalink
Post by Bob Butler
Post by Tony Proctor
VB accepts some variations of the ISO date format Andy, as does SQL.
For instance
Debug.print CDate("2006-11-30")
correctly yields 30-nov-2006. If you mean the ISO variation without
the separators then inserting them first shouldn't be too difficult
since the offsets are fixed.
Debug.Print Format$(#30-nov-2006#, "yyyy-mm-dd")
Post by Andy Fish
anyone know of any free source code in vb6 to convert between the
vb6 date type and ISO8601? Obviously converting vb->iso is easy, but
parsing is a bit more tricky
The DateSerial and TimeSerial functions are also useful when parsing dates
in fixed string formats
Thanks guys.

The problem is that iso8601 has a number of different variations. I would
like the software to be as open as possible so I'd rather have some kind of
library routine that accepts them all. However, it looks like I'm stuck with
rolling my own

Andy
Phill W.
2006-03-22 10:05:35 UTC
Permalink
Post by Andy Fish
I'm using the soap toolkit version 3 from VB6 and because I have complex
types in the API, I'm using the IXMLDOMNodeList interface.
anyone know of any free source code in vb6 to convert between the vb6 date
type and ISO8601?
Is that the one that drops a letter "T" between the date and time?
If so, replace the "T" with a space and, with a bit of luck, CDate()
should be able to make sense of it.

HTH,
Phill W.
Andy Fish
2006-03-29 12:58:25 UTC
Permalink
Post by Phill W.
Post by Andy Fish
I'm using the soap toolkit version 3 from VB6 and because I have complex
types in the API, I'm using the IXMLDOMNodeList interface.
anyone know of any free source code in vb6 to convert between the vb6
date type and ISO8601?
Is that the one that drops a letter "T" between the date and time?
If so, replace the "T" with a space and, with a bit of luck, CDate()
should be able to make sense of it.
unfortunately it's the "luck" element that I'd rather not rely on with VB
because experience has told me it runs out sooner or later

e.g. try cdate("0007-01-01") and you'll get either 7th jan 2001 or 1st july
2001 depending where you live

:-(((
Post by Phill W.
HTH,
Phill W.
Tony Proctor
2006-03-29 15:20:32 UTC
Permalink
That's an invalid ISO-format date Andy, and the results therefore don't
surprise me. Had it been

cdate("2007-01-01")

then the result would be unambiguous, with no 'luck' involved :-)

Tony Proctor
Post by Andy Fish
Post by Phill W.
Post by Andy Fish
I'm using the soap toolkit version 3 from VB6 and because I have complex
types in the API, I'm using the IXMLDOMNodeList interface.
anyone know of any free source code in vb6 to convert between the vb6
date type and ISO8601?
Is that the one that drops a letter "T" between the date and time?
If so, replace the "T" with a space and, with a bit of luck, CDate()
should be able to make sense of it.
unfortunately it's the "luck" element that I'd rather not rely on with VB
because experience has told me it runs out sooner or later
e.g. try cdate("0007-01-01") and you'll get either 7th jan 2001 or 1st july
2001 depending where you live
:-(((
Post by Phill W.
HTH,
Phill W.
a***@blueyonder.co.uk
2006-03-30 08:51:17 UTC
Permalink
the W3C document makes it clear that the YYYY part of the allows for
years back to 0001 (and in fact negative ones too). therefore AFAICT my
example is a valid representation of 1st Jan 7AD

Continue reading on narkive:
Loading...