[Mono-list] Problem with DateTime class from C code

Fede federico.omoto at gmail.com
Sat Oct 23 01:12:23 EDT 2010


Hi!

I've a problem when instantiating a DateTime class from C code and invoking
the ToString() method.
The code I've is as follows:

class = mono_class_from_name(mono_get_corlib(), "System", "DateTime");
object = mono_object_new(domain, class);
method = mono_class_get_method_from_name(class, "ToString", 0);
string = (MonoString*)mono_runtime_invoke(method, object, NULL, NULL);
printf("%s\n", mono_string_to_utf8(string));

It ouputs: 1/1/0001 12:00:03 AM
when the same C# code (Console.WriteLine(new DateTime().ToString()))
outputs: 1/1/0001 12:00:00 AM

What am I doing wrong?


Thank you in advance,

Federico Omoto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20101023/940e3428/attachment.html 


More information about the Mono-list mailing list