iOS Question Where can I find the CDate function?

davepamn

Active Member
Licensed User
Longtime User
B4X:
Dim iCurrentDate As Long
                DateTime.DateFormat="MM/dd/yyyy"
                Dim sBuffer As String=DateTime.Date(DateTime.Now)
                iCurrentDate=DateTime.DateParse(sBuffer)
                Dim per As Period
                per.Initialize
                per.Days=1

                For j=0 To 10
                    iCurrentDate=DateUtils.AddPeriod(iCurrentDate,per)
                    myList.Add(DateTime.Date(iCurrentDate))
                Next
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
B4X:
Sub DateAdd(sType As String,iInterval As Int,sDate As String) As String
    DateTime.DateFormat="MM/dd/yyyy"
    Dim iDate As Long
    Dim sRetVal As String=""
    iDate=DateTime.DateParse(sDate)

    Dim per As Period
    per.Initialize

    SelectCase sType
    'Day
    Case"d"
        per.Days=iInterval
    'Years
    Case"y"
        per.Years=iInterval
    'Hours
    Case"h"
        per.Hours=iInterval
    'Minute
    Case"n"
        per.Minutes=iInterval
    'Second
    Case"s"
        per.Seconds=iInterval
    EndSelect

    iDate=DateUtils.AddPeriod(iDate,per)

    sRetVal=DateTime.Date(iDate)

    Return(sRetVal)

End Sub

    DateTime.DateFormat="MM/dd/yyyy"
    Dim sCurrentDate As String=DateTime.Date(DateTime.Now)

                For j=0 To 10

                    myList.Add(oTransactionDate.DateAdd("d",j*-1,sCurrentDate))

                Next

Here is my solution for DateAdd
 
Upvote 0
Top