Categories
7.0 7.5 C#.NET HOW TO Microsoft SDK 7.1 VB.NET Visual Studio Windows Mobile Windows Phone

HOW TO add weeks to Date or DateTime

The Date and DateTime structures have the following methods:
AddYears(), AddMonths(), AddDays() but NOT AddWeeks() so you could use AddDays() to add the number of days of the week for each week or simply Add() to add TimeSpan, these aren’t professional solutions.

Use AddWeeks() method of Calendar class:

[sourcecode lang=”vb”]
Imports System.Globalization

Dim cal As New Calendar

Dim newDate as Date = cal.AddWeeks(myDateTime, 1).Date
Dim newDateTime as DateTime = cal.AddWeeks(myDateTime, 1)
[/sourcecode]

Also, you can use specific calendar changing Calendar class with others: GregorianCalendar, JapaneseCalendar, etc.
To read the complete list System.Globalization Namespace

Did my HOW TO help you? Leave a reply.

Categories
7.0 7.5 7.8 8.0 C#.NET Microsoft Nokia SDK 7.1 SDK 7.8 VB.NET Visual Studio Windows Phone

Microsoft Windows Phone – “0×89731811”

When you try to deploy a Windows Phone Project to a physical Windows Phone device show you the following error message:

0×89731811

Solution 1:

Launch the Zune software and check that the phone is connected to your pc.

Solution 2:

Deploy to Windows Phone Emulator

In Visual Studio, on the Standard toolbar, click Windows Phone Emulator.
Deploy to Windows Phone Emulator

Did my solution solve your problem? Leave a reply.