You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Tim K. (Gmane)" <tk...@ugcs.net> on 2005/03/24 19:53:34 UTC
Axis and .NET interop with dates
Hello,
What is the best way to pass dates back and forth from Java/Axis to .NET?
If you have a Java method to be exposed as a web service that returns a
date or takes as input a date, what should the Java type be? Date,
Calendar, long, String representation?
Are there any differences depending on the encoding to be used, e.g.
rpc/encoded or wrapped doc/lit?
Thank you.
--
Tim
Re: Axis and .NET interop with dates
Posted by Ellecer Valencia <el...@gmail.com>.
I would add that .Net has a problem with dates that are defined in
your schema as nillable="true". Might be safer to just pass around
strings and tell your client what is the format to use - ie, dates in
UCT, in yyyymmddhhss format.
references:
http://wiki.apache.org/ws/FrontPage/Axis/DotNetInterop
http://blogs.msdn.com/smguest/archive/2004/05/07/128113.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSerializationXmlSerializerClassTopic.asp
ellecer
On Fri, 25 Mar 2005 08:52:32 -0500, Christian faucher
<cb...@gmail.com> wrote:
> Hi,
>
> As another standardized way of passing date, you should consider julian dates.
>
> Julian dates are a integer, being the number of days since January 1,
> 4713 BC at noon (not midnight). You can also add a fraction of days,
> being the number of seconds elapsed since noon.
>
> Julian dates can be represnted as integers (for a precision to the
> day) or as double (for a precision to the millis).
>
> You can google algorihtms to convert back and forth between julian and
> gregorian dates, including support for February 29th and the leap that
> occured in 15-ish from Oct, 4 to Oct. 15.
>
> Just my 5 cents...
>
> Christian Faucher
>
Re: Axis and .NET interop with dates
Posted by Christian faucher <cb...@gmail.com>.
Hi,
As another standardized way of passing date, you should consider julian dates.
Julian dates are a integer, being the number of days since January 1,
4713 BC at noon (not midnight). You can also add a fraction of days,
being the number of seconds elapsed since noon.
Julian dates can be represnted as integers (for a precision to the
day) or as double (for a precision to the millis).
You can google algorihtms to convert back and forth between julian and
gregorian dates, including support for February 29th and the leap that
occured in 15-ish from Oct, 4 to Oct. 15.
Just my 5 cents...
Christian Faucher
Re: Axis and .NET interop with dates
Posted by James Black <jb...@ieee.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tim K. (Gmane) wrote:
| So is there a way to make a Java Date/Calendar just interoperate with
| the .NET DateTime type whithout any of the sides to make any
| conversions? I understand that in .NET DateTime can be converted to a
| long but it represents "the number of 100-nanosecond intervals that have
| elapsed since 12:00 A.M., January 1, 0001"
~ This is my function to get unixtime from .net:
protected long getUnixTime()
{
TimeSpan ts = (DateTime.UtcNow - new DateTime(1970,1,1,0,0,0));
double unixTime = ts.TotalSeconds;
return (long)unixTime;
}
- --
"Love is mutual self-giving that ends in self-recovery." Fulton Sheen
James Black james@usf.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCQxWNikQgpVn8xrARAgB5AKCMlI7Xv6IwK9GbQKvMT5EBhrintgCfRHoA
eKFrlLwkRGMcBJb4oa9aC3M=
=+LmO
-----END PGP SIGNATURE-----
Re: Axis and .NET interop with dates
Posted by "Tim K. (Gmane)" <tk...@ugcs.net>.
So is there a way to make a Java Date/Calendar just interoperate with
the .NET DateTime type whithout any of the sides to make any
conversions? I understand that in .NET DateTime can be converted to a
long but it represents "the number of 100-nanosecond intervals that have
elapsed since 12:00 A.M., January 1, 0001"
Tim
James Black wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Tim K. (Gmane) wrote:
> | If you have a Java method to be exposed as a web service that returns a
> | date or takes as input a date, what should the Java type be? Date,
> | Calendar, long, String representation?
>
> ~ I use long, and pass the unix time, or
> DD:MM:YY HH:MM:SS
> though the second part is optional, but I have to dictate the pattern to
> use, and this is a string, for my .net clients.
>
> - --
> "Love is mutual self-giving that ends in self-recovery." Fulton Sheen
> James Black james@usf.edu
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFCQw2GikQgpVn8xrARAo2nAJkBbEMsZap3SViBzicTlLdC2V2qfwCgjuB/
> Jk9rQnBaj/JNiwa3xhGhEcs=
> =tywm
> -----END PGP SIGNATURE-----
>
Re: Axis and .NET interop with dates
Posted by James Black <jb...@ieee.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tim K. (Gmane) wrote:
| If you have a Java method to be exposed as a web service that returns a
| date or takes as input a date, what should the Java type be? Date,
| Calendar, long, String representation?
~ I use long, and pass the unix time, or
DD:MM:YY HH:MM:SS
though the second part is optional, but I have to dictate the pattern to
use, and this is a string, for my .net clients.
- --
"Love is mutual self-giving that ends in self-recovery." Fulton Sheen
James Black james@usf.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCQw2GikQgpVn8xrARAo2nAJkBbEMsZap3SViBzicTlLdC2V2qfwCgjuB/
Jk9rQnBaj/JNiwa3xhGhEcs=
=tywm
-----END PGP SIGNATURE-----