Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accpac Date Format in VB6 1

Status
Not open for further replies.

AccPal

Programmer
Jun 13, 2009
8
Hi there

im doing a vb6 app using accpac data to refrence from but im struggling to format the date in VB6

as we all know it formats it 20110216 and i want to format it 16/02/2011

in crystal reports its simple enough to use pwformatdate

using the following gives me a overflow
textbox = Format(Text3.Text, "dd/mm/yyyy")
please help
i hope im not missing something ?
 
I use the following:
Code:
Public Function pwFormatDate(aInValue As Long) As Date
'20081101 => 11/01/2008
    If aInValue = 0 Then
        pwFormatDate = DateSerial(1899, 12, 30)
        Exit Function
    End If

Dim y, m, D As Integer
  y = Round(aInValue / 10000, 0)
  m = Round((aInValue - (y * 10000)) / 100, 0)
  D = aInValue - ((y * 10000) + (m * 100))
  
  
  pwFormatDate = DateSerial(y, m, D)

End Function
 
thanks mate it seems to be working im tweeking it slightly though
do you know how to use te date diff function or a good way to see how many days difference there are between two dates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top