473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Sending DateTime to other platforms question.

Hi,

I'm writing a server applicaiton using C# and .NET Framework.
This server sends out time to all the clients. The clients are expected to
be
written in various platforms for example, Delphi, VB 6.0, C/C++, Java etc.

How I can send the DateTime from .NET Framework to all these other platforms.
I heard that sending time in "double" format would be accepted by all the
platforms.

Can we convert DateTime in C# to Double at all?
If we use DateTime.ToFileTime() which return an Int64, can other platforms
covert this Int64 back to the time?

Kindly let me know.

Cheers,

Naveen.

Nov 17 '05 #1
5 5862
What about sending it as a string, formatted as YYYY-MM-DD HH:MM for
example?

That way, you can perform conversions specific to each platform and away you
go?

"Naveen Mukkelli" <Na************@discussions.microsoft.com> wrote in
message news:07**********************************@microsof t.com...
Hi,

I'm writing a server applicaiton using C# and .NET Framework.
This server sends out time to all the clients. The clients are expected to
be
written in various platforms for example, Delphi, VB 6.0, C/C++, Java etc.

How I can send the DateTime from .NET Framework to all these other
platforms.
I heard that sending time in "double" format would be accepted by all the
platforms.

Can we convert DateTime in C# to Double at all?
If we use DateTime.ToFileTime() which return an Int64, can other
platforms
covert this Int64 back to the time?

Kindly let me know.

Cheers,

Naveen.

Nov 17 '05 #2
Hi Naveen,

"Naveen Mukkelli" <Na************@discussions.microsoft.com> schreef in
bericht news:07**********************************@microsof t.com...
Hi,

I'm writing a server applicaiton using C# and .NET Framework.
This server sends out time to all the clients. The clients are expected to
be
written in various platforms for example, Delphi, VB 6.0, C/C++, Java etc.

How I can send the DateTime from .NET Framework to all these other
platforms.
I heard that sending time in "double" format would be accepted by all the
platforms.

Can we convert DateTime in C# to Double at all?
If we use DateTime.ToFileTime() which return an Int64, can other
platforms
covert this Int64 back to the time?

Kindly let me know.

Cheers,
Naveen.


You could choose XML as the interchange data format, and use the xs:dateTime
data type. The internet has a lot of useful pages to help you out for using
Xml, this one is probably good too http://www.w3.org/XML/Schema. The .NET
Framework has a namespace with a lot of classes to work with Xml,
System.Xml.

Hope this helps,
Tom T.
Nov 17 '05 #3
Hi Naveen,

Personally I'd follow the other's suggestions of using strings or
xsd:datetime formats, but if your heart is set on a numeric datatype
then you can use DateTime.ToOADate to convert to a Double, or you can
use the DateTime.Ticks property to return an Int64 that you can write
conversion routines for from within your other platform routines.

I can't speak for other platforms but the double valuer returned by
ToOADate translates directly into a TDateTime datatype on the Delphi
side.

I have developed Delphi code to convert a .NET DateTime.Ticks property
value to a TDateTime if you're interested.

Regards,
Scott

On Tue, 10 May 2005 19:06:01 -0700, Naveen Mukkelli
<Na************@discussions.microsoft.com> wrote:
Hi,

I'm writing a server applicaiton using C# and .NET Framework.
This server sends out time to all the clients. The clients are expected to
be
written in various platforms for example, Delphi, VB 6.0, C/C++, Java etc.

How I can send the DateTime from .NET Framework to all these other platforms.
I heard that sending time in "double" format would be accepted by all the
platforms.

Can we convert DateTime in C# to Double at all?
If we use DateTime.ToFileTime() which return an Int64, can other platforms
covert this Int64 back to the time?

Kindly let me know.

Cheers,

Naveen.


Nov 17 '05 #4
Hi guys,

Thanks for taking time to posting replies.

What happens if we just send DateTime from .NET(C#).
Would the other platforms be able to pick up the correct time from .NET
DateTime.

Cheers,

Naveen.

"Scott Maskiel" wrote:
Hi Naveen,

Personally I'd follow the other's suggestions of using strings or
xsd:datetime formats, but if your heart is set on a numeric datatype
then you can use DateTime.ToOADate to convert to a Double, or you can
use the DateTime.Ticks property to return an Int64 that you can write
conversion routines for from within your other platform routines.

I can't speak for other platforms but the double valuer returned by
ToOADate translates directly into a TDateTime datatype on the Delphi
side.

I have developed Delphi code to convert a .NET DateTime.Ticks property
value to a TDateTime if you're interested.

Regards,
Scott

On Tue, 10 May 2005 19:06:01 -0700, Naveen Mukkelli
<Na************@discussions.microsoft.com> wrote:
Hi,

I'm writing a server applicaiton using C# and .NET Framework.
This server sends out time to all the clients. The clients are expected to
be
written in various platforms for example, Delphi, VB 6.0, C/C++, Java etc.

How I can send the DateTime from .NET Framework to all these other platforms.
I heard that sending time in "double" format would be accepted by all the
platforms.

Can we convert DateTime in C# to Double at all?
If we use DateTime.ToFileTime() which return an Int64, can other platforms
covert this Int64 back to the time?

Kindly let me know.

Cheers,

Naveen.


Nov 17 '05 #5
Naveen,

"Naveen Mukkelli" <Na************@discussions.microsoft.com> schreef in
bericht news:9E**********************************@microsof t.com...
Hi guys,

Thanks for taking time to posting replies.

What happens if we just send DateTime from .NET(C#).
Would the other platforms be able to pick up the correct time from .NET
DateTime.

Cheers,
Naveen.


I don't see any way of doing that, since each platform or framework has its
own representation of a DateTime data type. I think on the binary level that
there is little or no compatibility with other platforms.

Hence you choose a platform independent representation, and the best choice
now is XML. The XML Schema Definition Standard (XSD) defines types as
xs:dateTime or xs:time and the like. Nowadays I think every platform
supports XML so I think the choice is easy.

Unless of course you define your own (binary) serialization, and have a
framework on each platform that can convert it to the platform's natural
date-time structure.

Hope this helps,
Tom T.
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
4
by: shaboo | last post by:
Hi Guys, I have just installed Python2.4.2 on our HP-UX system. But when I try to import datetime modlue I get the following error ~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> from datetime import...
5
by: Brendan | last post by:
Hi All I can't find the "Python Way" of writing a datetime instance to a string so that it can be easily parsed back again. time.strptime is apparantly not supported on some platforms, and...
5
by: Simen Haugen | last post by:
Hi. How can I convert a python datetime to a timestamp? It's easy to convert a timestamp to datetime (datetime.datetime.fromtimestamp(), but the other way around...?) -Simen
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
0
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using...
6
by: Rushwire | last post by:
Does anybody know how to send a meeting request using an ics/vcs (VCalendar) attachment from an asp.net page. I don't want my users to have to double click on the attachment but rather that it is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.