This project is read-only.

DateTime Namespace [solved]

Mar 12, 2012 at 5:21 PM

Hello everyone.

I am new to C# and I had a question about adding a plug to the Cosmos User Kit.

I wanted to have 'date' and 'time' commands like MS-DOS. Here is my code for the 'time' command.

if (code.Substring(0, 4) == "time")
{
        // Command 'time
        Console.WriteLine("")
        Console.WriteLine("Time will be displayed here.");
        if (code.Length > 4)
        {
            // Runs if there is more to the command then just 'time'
            Retriever(code.Substring(4));
        }
        Input("");
}
I wanted to replace "Console.WriteLine("Time will be displayed here.")" with some code to display the time, but I receive an error when I try to use the DateTime namespace that says I need a plug.
What should I do?
Mar 12, 2012 at 9:10 PM
WMH123 wrote:

Hello everyone.

I am new to C# and I had a question about adding a plug to the Cosmos User Kit.

I wanted to have 'date' and 'time' commands like MS-DOS. Here is my code for the 'time' command.

if (code.Substring(0, 4) == "time")
{
        // Command 'time
        Console.WriteLine("")
        Console.WriteLine("Time will be displayed here.");
        if (code.Length > 4)
        {
            // Runs if there is more to the command then just 'time'
            Retriever(code.Substring(4));
        }
        Input("");
}
I wanted to replace "Console.WriteLine("Time will be displayed here.")" with some code to display the time, but I receive an error when I try to use the DateTime namespace that says I need a plug.
What should I do?

You need to use Cosmos.Hardware.RTC.

Example: Cosmos.Hardware.RTC.Minute, Cosmos.Hardware.RTC.Second, Cosmos.Hardware.RTC.Hour ect. Hope it helps - Matt

Mar 13, 2012 at 4:14 PM
Edited Mar 13, 2012 at 10:35 PM

Thank you.

I was able to get it to work.