开发者

How do I subtract a second from a DateTime in Windows Phone 7?

开发者 https://www.devze.com 2023-03-26 02:34 出处:网络
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.

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消