Public void TimeExample(TdCommand cmd, String studentId, String classId)
{
cmd.Parameters.Clear();
cmd.CommandText = "TimeEnrolledInClass";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(null, TdType.Varchar, 9,
System.Data.ParameterDirection.Input, true, 0, 0, null,
System.Data.DataRowVersion.Default, studentId);
cmd.Parameters.Add(null, TdType.Varchar, 9,
System.Data.ParameterDirection.Input, true, 0, 0, null,
System.Data.DataRowVersion.Default, classId);
cmd.Parameters.Add(null, TdType.Varchar, 0,
System.Data.ParameterDirection.Output, true, 0, 0, null,
System.Data.DataRowVersion.Default, null);
cmd.ExecuteNonQuery();
// Using TdTimestampWithTimeZone to get the time that the student enrolled
// in the class
TdTimestampWithTimeZone timeEnrolled = (TdTimestampWithTimeZone)cmd.Parameters[0].ProviderSpecificValue;
// Add 5 days to the time Enrolled.
TdTimestampwithTimeZone newTime = timeEnrolled + new TimeSpan(5, 0, 0);
// Typecast the newTime to a TdDate
TdDate dateEnrolled = (TdDate)timeEnrolled;
// Print out the timeEnrolled to the console
Console.WriteLine("Time enrolled {0}", timeEnrolled);
// Convert the timeEnrolled to a String
String enrolled = timeEnrolled.ToString();
}