2011-08-06 8 views
8

Estoy tratando de restar un segundo del valor del tiempo en un selector de tiempo. Encontré el código para agregar un segundo al valor del selector, pero no pude entender cómo restar.¿Cómo restar un segundo de DateTime en Windows Phone 7?

¿Cómo debo hacerlo?

private static void CreateAlarm(DateTime time, string title) 
{ 
    var alarm = new Alarm(title) 
    { 
     Content = "You have a meeting with your team now.", 
     BeginTime = time.AddSeconds(10), 
    }; 
} 

private void SetAlarm_Click(object sender, RoutedEventArgs e) 
{ 
    CreateAlarm(Convert.ToDateTime(timePicker1.ValueString), textBox1.Text); 
} 

Respuesta

16

Sólo añadir un signo menos:

EndTime = time.AddSeconds(-10)