xml/vb/java common date format

A

Andy Fish

Hi,

I have an application with a vb6 client that talks to a java server and
passes XML back and forward, and I'm wondering what's the best format to
transfer date/time values between them in an XML attribute.

my first thougtht was to use RFC822 date/time format because I can produce
and consume those with javamail's MailDateFormat, but I can't find code to
do that for VB (well, I found one module on vbrad.com but it wouldn't parse
the dates created by MailDateFormat)

I really hate reinventing the wheel - does anyone know of a date/time format
that can be used with minimal fuss and maximum portability, with free code
available for both java and vb

Andy
 
J

J French

Hi,

I have an application with a vb6 client that talks to a java server and
passes XML back and forward, and I'm wondering what's the best format to
transfer date/time values between them in an XML attribute.

my first thougtht was to use RFC822 date/time format because I can produce
and consume those with javamail's MailDateFormat, but I can't find code to
do that for VB (well, I found one module on vbrad.com but it wouldn't parse
the dates created by MailDateFormat)

I really hate reinventing the wheel - does anyone know of a date/time format
that can be used with minimal fuss and maximum portability, with free code
available for both java and vb

I don't know about Java but ...

I would definitely opt for : yyyy-mm-dd hh:mm:ss (24 hour)

Have a look at VB's Format() command

For decoding I strongly recommend that you do it yourself using Mid$()
and Val()
- then make a Date (8 byte IEEE) using DateSerial and TimeSerial

VB is far too clever at decoding a Date String
- it is also 'locale' aware
 
S

Steve Gerrard

Andy Fish said:
Hi,

I have an application with a vb6 client that talks to a java server and
passes XML back and forward, and I'm wondering what's the best format to
transfer date/time values between them in an XML attribute.

This is some poop out of MSDN on XML data types. It is from Microsoft,
but it at least has the appearance of being universal and not system
specific. I would think most XML parsers would process these correctly.

<Schema name="myschema"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
</Schema>

XML Data Types:

date: Date in a subset ISO 8601 format, without the time data. For
example: "1994-11-05".

dateTime: Date in a subset of ISO 8601 format, with optional time and no
optional zone. For example, "1988-04-07T18:39:09".

dateTime.tz: Date in a subset ISO 8601 format, with optional time and
optional zone. For example: 1988-04-07T18:39:09-08:00".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top