Results 1 to 3 of 3

Thread: [RESOLVED] DatetimePicker

  1. #1

    Thread Starter
    Fanatic Member daimous's Avatar
    Join Date
    Aug 2005
    Posts
    657

    Resolved [RESOLVED] DatetimePicker

    hello guyz!!! how can i get the last 2 digits of the year from the value of my datetimepicker? say, datetimepicker1 has a value of 8/2/2006 how can i get the '06' from 8/2/2006? thanks in advance!
    Last edited by Hack; Aug 8th, 2006 at 11:08 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: DatetimePicker

    To get a string:
    Code:
    string shortYear = myDTP.Value.ToString("yy");
    To get a number:
    Code:
    int shortYear = myDTP.Value.Year % 100
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member daimous's Avatar
    Join Date
    Aug 2005
    Posts
    657

    Re: DatetimePicker

    Thanks a lot for that!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width