|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
vb6 and iso 8601 date formatHi,
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 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 Show quoteHide quote "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message news:#9lpFnQTGHA.4960@TK2MSFTNGP12.phx.gbl... > 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 > >
Show quote
Hide quote
"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in The DateSerial and TimeSerial functions are also useful when parsing datesmessage news:ufykDKRTGHA.1868@TK2MSFTNGP09.phx.gbl > 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") > "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message > news:#9lpFnQTGHA.4960@TK2MSFTNGP12.phx.gbl... >> 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 in fixed string formats -- Reply to the group so all can participate VB.Net: "Fool me once..."
Show quote
Hide quote
"Bob Butler" <tiredofit@nospam.com> wrote in message Thanks guys.news:eCvRmjSTGHA.4864@TK2MSFTNGP12.phx.gbl... > "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in > message news:ufykDKRTGHA.1868@TK2MSFTNGP09.phx.gbl >> 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") >> "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message >> news:#9lpFnQTGHA.4960@TK2MSFTNGP12.phx.gbl... >>> 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 > 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 "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message Is that the one that drops a letter "T" between the date and time?news:%239lpFnQTGHA.4960@TK2MSFTNGP12.phx.gbl... > 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? 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.
Show quote
Hide quote
"Phill W." <p-.a-.w-a-r-d@o-p-e-n.a-c.u-k> wrote in message unfortunately it's the "luck" element that I'd rather not rely on with VB news:dvr7ec$hes$1@yarrow.open.ac.uk... > > "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message > news:%239lpFnQTGHA.4960@TK2MSFTNGP12.phx.gbl... > >> 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. > 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 Show quoteHide quote :-((( > HTH, > Phill W. > > 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 Show quoteHide quote "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message news:#fe#4BzUGHA.4300@TK2MSFTNGP14.phx.gbl... > > "Phill W." <p-.a-.w-a-r-d@o-p-e-n.a-c.u-k> wrote in message > news:dvr7ec$hes$1@yarrow.open.ac.uk... > > > > "Andy Fish" <ajf***@blueyonder.co.uk> wrote in message > > news:%239lpFnQTGHA.4960@TK2MSFTNGP12.phx.gbl... > > > >> 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 > > :-((( > > > > HTH, > > Phill W. > > > > > > |
|||||||||||||||||||||||