Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21969

[RESOLVED] format date function

$
0
0
hi
i have this code
Code:

Public Sub Annually(SecID As String, INTSTRTDTE As String, INTENDDTE As String)

Dim dteRunningDate As String
Dim i As Integer
Dim intInterval As Integer
Dim sTempCalendar As String
Dim sid As String
 Dim sSql As String
 Dim Seq As String
Dim sTempCCY As String
Dim mydate As String
 

'sSql = "delete t1 from SCHC as t1 join (select SecID from SCHC group by SecID)t2 on t1.SecID = t2.SecID Where t1.SecID = t2.SecID"
'sSql = "DELETE FROM SCHC WHERE SECID = '" & UCase(text1(0).Text) & "'"
 ' DBCALL "SELECT", "SCHC", sSql
 
 'Seq = 0
 dteRunningDate = CheckDateRules(DateAdd("m", 12, INTSTRTDTE))
 dteRunningDate = Format(CDate(dteRunningDate), "dd mmm yyyy")
 Debug.Print dteRunningDate

Dim iTextbox As Integer
iTextbox = 2
text1(iTextbox).Text = INTSTRTDTE
    Do While dteRunningDate <= INTENDDTE
   
      text1(iTextbox).Text = dteRunningDate
        iTextbox = iTextbox + 1
         
      '  sSql = "INSERT INTO SCHC VALUES('" & SecID & "','" & Seq & "','" & INTSTRTDTE & "','" & dteRunningDate & "')"
       
      ' DBCALL "SELECT", "SCHC", sSql
      '    If result <> 100 Then
        '        Message 43
        '      result = 1
        '  End If
Debug.Print SecID & vbTab; Seq & vbTab; INTSTRTDTE & vbTab & dteRunningDate
      INTSTRTDTE = dteRunningDate
 
        dteRunningDate = CheckDateRules(DateAdd("m", 12, dteRunningDate))
 
      'Seq = Seq + 1
 
  Loop
 
  If dteRunningDate <> INTENDDTE Then
      '  sSql = "INSERT INTO SCHC VALUES('" & SecID & "','" & Seq & "','" & INTSTRTDTE & "','" & INTENDDTE & "')"
        '        DBCALL "SELECT", "SCHC", sSql
        '    If result <> 100 Then
          '    Message 43
          '    result = 1
            End If
  ' End If

End Sub

dterunningdate come in as 1/1/2012
im trying to use the date formate function to change this over was tryin this but it does not seem to work
Code:

dteRunningDate = Format(CDate(dteRunningDate), "dd mmm yyyy")
is that right or do i need more

Viewing all articles
Browse latest Browse all 21969

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>