3 Replies - 911 Views - Last Post: 15 November 2013 - 11:52 AM Rate Topic: -----

#1 korfx04   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 05-August 09

Date (MM/DD/YYY) into Days.

Posted 14 November 2013 - 10:50 PM

I Have a Date in a Label "Started on: 11/06/2013"

and another label that says "Day: 0"
and another label that says "Week: 0"

What i'm looking to do is when the program runs every day, it will read the started on date and tell me how many days it's on and the week its on from the start date..

So it should read like this.....

Started on: 11/06/2013
Week: 1
Day: 10

I Hope someone can help me out with this as i'm not very good. I Just know the basic things for myself to make my life easier. I'm not going to lie and tell you i searched because i haven't really, i tried but i have no idea what i'm looking for. I Been wanting to add this to my custom program all year, but i just don't know how.

If someone can help me, it would really, really help me out so much!

Is This A Good Question/Topic? 0
  • +

Replies To: Date (MM/DD/YYY) into Days.

#2 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3098
  • View blog
  • Posts: 11,844
  • Joined: 03-December 12

Re: Date (MM/DD/YYY) into Days.

Posted 14 November 2013 - 11:02 PM

So you need a start date and a timespan object.
Then timespan - now = days.

Have you looked at timespans in msdn?
Was This Post Helpful? 0
  • +
  • -

#3 korfx04   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 05-August 09

Re: Date (MM/DD/YYY) into Days.

Posted 15 November 2013 - 11:41 AM

View Postastonecipher, on 14 November 2013 - 11:02 PM, said:

So you need a start date and a timespan object.
Then timespan - now = days.

Have you looked at timespans in msdn?

Thank you for that...

Here's my code.
        Dim StartDate As Date = started_date_txt.Text
        Dim NumberOfDays As Integer
        Dim DayTimeSpan As TimeSpan

        DayTimeSpan = Now.Subtract(StartDate)
        NumberOfDays = DayTimeSpan.Days
        Label26.Text = DayTimeSpan.Days

This post has been edited by AdamSpeight2008: 15 November 2013 - 01:39 PM

Was This Post Helpful? 0
  • +
  • -

#4 DarenR   User is offline

  • D.I.C Lover

Reputation: 638
  • View blog
  • Posts: 4,228
  • Joined: 12-January 10

Re: Date (MM/DD/YYY) into Days.

Posted 15 November 2013 - 11:52 AM

use datepart

http://msdn.microsof...z(v=vs.90).aspx
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1