Results 1 to 6 of 6

Thread: Convert Date to Integer...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297

    Convert Date to Integer...

    Howdy folks,

    How do I convert a date into an integer a la VB 6?

    Thanks,
    Ben

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Not sure about VB6, but what do you want the integer to represent?

    Ticks will give you a Long - "The value of this property is the number of 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001" - MSDN

    I've seen some databases that store dates (not date/time) as the number of days since some start date - these are usually integers - but not sure if that's what you're after.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297
    I'll be honest, I don't actually know what I'm talking about.

    I've got a control that was developed for VB 6 that I'm using in my VB.NET application. Here is a help excerpt from a function I want to use:

    Code:
    Parameters
    ·	1 - nIndex	: ( integer ) The index value of the item to receive the bar
    ·	2 - lTimeStart	: ( long ) The starting time for the bar
    ·	3 - lTimeEnd	: ( long ) The ending time for the bar
    ·	4 - lDateStart	: ( long ) The starting date for the bar
    ·	5 - lDateEnd	: ( long ) The ending date for the bar
    
    Example
    
    	nBar = ctSchedule.AddTimeBar(nIndex, 240, 600, 35550, 35550)
    Does anyone know how I would translate a date into that '35550' number?

    Thanks,

    Ben

  4. #4
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Do you know the date that 35550 represents? I'm guessing that if they're using seperate time and date fields, 35550 is the number of days since a certain start date - but you need to know what the start date is, or you can figure it out if you know the date of 35550.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297
    Good call,

    I can reverse out a date from the control and determine what that number is.

    Thanks for your help,

    Ben

  6. #6
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Convert date to number and number to date

    Hi,

    Convert date to number and number to date

    Watch and copy examples of Source Code in VB.NET

    http://www.run.to/yulyos-vbnetat

    Have a nice day

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