Android Question HH:MM to ticks ?

Colin Evans

Active Member
Licensed User
Longtime User
Hi, I've looked in the forum and I'm sure it's a quick fix but I can't find a way of changing a time entry of say 12:30 to ticks
Anybody know the answer please
 

Colin Evans

Active Member
Licensed User
Longtime User
Must be having a brain freeze, just added the date and now working wonderfully, thank you
 
Upvote 0

Colin Evans

Active Member
Licensed User
Longtime User
DonManfred

Thought I'd sorted it but getting java.text.ParseException: Unparseable date: "05/01/2022 14:55"

newdate = "05/01/2022"
TimeFrom = "14:55"

DateTime.DateFormat = "dd/MM/yyyy hh:mm"

Dim tfrom As Long = DateTime.dateParse(newDate & " " & txtFrom.Text)

Any pointers on what I'm doing wrong
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
DateTime.DateFormat = "dd/MM/yyyy hh:mm"
Here is an example
B4X:
DateTime.DateFormat = "dd/MM/yyyy"
    DateTime.TimeFormat = "HH:mm"   
    Dim newdate As String = "05/01/2022"
    Dim TimeFrom As String = "14:55"
    Log(DateTime.DateTimeParse(newdate,TimeFrom))

or:
B4X:
DateTime.DateFormat = "dd/MM/yyyy HH:mm"
    Dim newdate As String = "05/01/2022"
    Dim TimeFrom As String = "14:55"
    Log(DateTime.DateParse(newdate & " " & TimeFrom))
 
Last edited:
Upvote 0

Colin Evans

Active Member
Licensed User
Longtime User
Can't believe it was something so stupid that I missed, I've been putting hh instead of HH, thank you Mahres (and DonManFred), I'd tried all the various formats I could think of but always put hh, I've slapped my wrists and moving on, thanks again
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…