CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009
    Posts
    128

    Question display date using format ?

    i want to display date in a text box which is in a flex grid

    Code:
     
             Estval = bookval.EstimatedLife  'here value in Estval = 700
            Estval = Estval / 100                    'here value in Estval = 7
           MainBookFlexGrid(1).col = col
            MainBookFlexGrid(1).Row = 5
          MainBookFlexGrid(1).Text = Format(Estval, "00 yrs 00 mos")   'here it becomes 00 yrs 07 mos


    MainBookFlexGrid(1).Text = Format(Estval, "00 yrs 00 mos")--->this displays 00 yrs 07 mos instead of 07 yrs 00 mos


    where am i going wrong?
    plz help..
    Last edited by dskp; September 2nd, 2011 at 07:11 AM.

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: display date using format ?

    Seems like the format you are using basically splits the value such that the "mos" get the two right-most digits, and the "yrs" get everything to the left of that. So a value of 100 yields 01 yrs and 00 mos. A value of 700 would therefore give you "07 yrs 00 mos".
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: display date using format ?

    Your format construction is wrong.
    You have to know what the unit of Estval is in order to write a proper format instruction.
    What does the 700 signify? Days? Months?

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

Featured