Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Working with DateTime - Day 2 - Part 2

Download

Right click “Save as…”

When working with Silverlight applications for the Windows Phone 7, you'll often need to work with a date and/or time. This video demonstrates how to work with the DateTime class and TimeSpan class to add dates, calculate differences in time, retrieve parts of a DateTime object, format for display, and more.

Download the source code in c#

Download the source code in VB.Net

Follow the Discussion

  • John MarshallJohn Marshall

    So is your birthday Dec 7th or July 12th?
    Rembmer, this is an international audience and your code would fail if the day of the month was greater than 12.

  • @John ... Yikes ... good point.  I can't remember everything I did in this video (and I hate watching myself!!!) but depending on how I went about this, I would hope that my phone's location settings would iron this out magically for me.  I may need to revisit this if I get a lot of negative feedback on it.  Sorry about that!

  • EDEEDE

    HEY is something wrong with the WMV HQ FILE?!  :|

  • EDEEDE

    sorry i had encountered a bug with my media player. :D

  • Some great methods there to use. I'm surprised by the vast amount of methods on offer and what they do, I can have fun with the date and time one but hoping it is intelligent enough to recognise if im using a date first rather than a month.

    Cheers Bob.

  • @BobTabor. Loving the tutorial, thanks for the clear, descriptive videos.On the point about whether the phone's regional settings would sort out DateTime.Parse if it was entered dd/mm/yyyy instead of mm/dd/yyyy - you are right that the phone will do this. If anyone wants to try it you can do this in the Settings screen under Region and Language in the emulator. If you scroll down there is a System Locale setting. Just remember to hit the 'Tap here to save your changes' if you do change the option (for example I used United Kingdom). The emulator will restart, and save your settings - so just go back and revert if you want to change back.

  • thanks Bob

  • Hi Guys!

    I'm wondering why my IDE not adds () to methods, if i choose them from auto completion.

    For example:

    I type myDateValue.

    now i choose ToString from the auto-completion and it just adds "ToString" but not "ToString()" how I expected.

    Its not really a big Problem but u know, developers are lazy ^^

    Is there an option in VS to change that behavior?

     

    Regards & Thanks

     

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.