Android Question Unparseable Date

benji

Active Member
Licensed User
Longtime User
Hello,
i have a strange(?) problem... this code works in olds program, same device, but now not works
i try with dateformat "yyyy-MM-dd" and "dd-MM-yyyy" with "/" too
i try parse the string date "Auxdesde" and "AuxHasta"
and finally try with the Long(LongDesde and LongHasta are long), but, not works

the code stop here...
If LongDesde <= LongHasta Then

i try with AuxDesde <= AuxHasta
i try with datetime.dateparse(AuxDesde <= AuxHasta)

where is my error?



B4X:
Sub lblSelFecha_Click
    Dim Fecha As DateDialog
    Dim ret As String
    
    Fecha.DateTicks = DateTime.Now
    ret = Fecha.Show("Seleccione Fecha Desde", "Ventas", "OK", "Salir", "", Null)
    If ret = DialogResponse.CANCEL Then Return
    DateTime.TimeFormat="dd-MM-yyyy"
    txtFecha.Text = DateTime.time(Fecha.DateTicks)
    DateTime.TimeFormat="dd-MM-yyyy"
    'AuxDesde = DateTime.time(Fecha.DateTicks)
    'LongDesde = DateTime.DateParse(AuxDesde)
    LongDesde = DateTime.time(Fecha.DateTicks)

    'CargarTabla
End Sub

Sub CargarTabla
    Dim Tbid As Int
    Dim TbFecha As String
    Dim TbHora As String
    Dim TbValor As Int
    Dim AuxAcum As Int

    Table1.ClearAll
    CurTabla = Main.DbMain.ExecQuery("Select * from boletas Where Fecha >= '" & txtFecha.Text & "' and Fecha <= '" & txtHasta.Text & "';")
    AuxAcum = 0
    If CurTabla.RowCount > 0 Then
        For i = 0 To CurTabla.RowCount - 1
            CurTabla.Position = i
            Tbid = CurTabla.GetInt("id")
            TbFecha = CurTabla.GetString("Fecha")
            TbHora = CurTabla.GetString("Hora")
            TbValor = CurTabla.GetInt("Valor")
            AuxAcum = AuxAcum + TbValor
            Table1.AddRow(Array As String(Tbid,TbFecha,TbHora,TbValor))
        Next
        Table1.AddRow(Array As String("","","",""))
        Table1.AddRow(Array As String("","","Boletas:",CurTabla.RowCount))
        Table1.AddRow(Array As String("","","TOTAL:",AuxAcum))
    Else
        Msgbox("No Hay Ventas para este Periodo","Detalle Ventas")
    End If
End Sub

Sub lblSelHasta_Click
    Dim Fecha As DateDialog
    Dim ret As String
    
    
    Fecha.DateTicks = DateTime.Now
    ret = Fecha.Show("Seleccione Fecha Hasta", "Boleta", "OK", "Salir", "", Null)
    If ret = DialogResponse.CANCEL Then Return
    DateTime.TimeFormat="dd-MM-yyyy"
    txtHasta.Text = DateTime.time(Fecha.DateTicks)
    DateTime.TimeFormat="dd-MM-yyyy"
    'AuxHasta = DateTime.time(Fecha.DateTicks)
    'LongHasta = DateTime.DateParse(AuxHasta)
    LongHasta = DateTime.time(Fecha.DateTicks)
    
    If LongDesde <= LongHasta Then
        CargarTabla
    Else
        Msgbox("Fecha Desde debe ser Menor fecha Hasta","Boleta")
    End If
End Sub

Thanks in advance
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…