[英]How do I subtract a second from a DateTime in Windows Phone 7?
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.
我发现代码在picker值中添加了第二个,但我无法弄清楚如何减去。
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);
}
只需添加一个减号:
EndTime = time.AddSeconds(-10)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.