I am trying to subtract a second from time value in a time picker. I found the code 开发者_如何学编程to add a second to the picker value, but I couldn't figure out how to subtract.
How should I go about doing it?
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);
}
Just add a minus sign:
EndTime = time.AddSeconds(-10)
精彩评论