moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #1 Hi all, i use this format for time : B4X: datetime.dateformat = "HHmmss" to write in database table When i read the info from db table i use this format for time: B4X: datetime.dateformat = "HHmmss" datetime.timeparse("datefield in format HHmmss") if hour is smaller than 10 the program crash where i wrong ?
Hi all, i use this format for time : B4X: datetime.dateformat = "HHmmss" to write in database table When i read the info from db table i use this format for time: B4X: datetime.dateformat = "HHmmss" datetime.timeparse("datefield in format HHmmss") if hour is smaller than 10 the program crash where i wrong ?
Star-Dust Expert Licensed User Longtime User Jun 17, 2021 #2 moore_it said: Hi all, i use this format for time : B4X: datetime.dateformat = "HHmmss" to write in database table When i read the info from db table i use this format for time: B4X: datetime.dateformat = "HHmmss" datetime.timeparse("datefield in format HHmmss") if hour is smaller than 10 the program crash where i wrong ? Click to expand... Do I always sign the hours with 2 digits? (type 03) Upvote 0
moore_it said: Hi all, i use this format for time : B4X: datetime.dateformat = "HHmmss" to write in database table When i read the info from db table i use this format for time: B4X: datetime.dateformat = "HHmmss" datetime.timeparse("datefield in format HHmmss") if hour is smaller than 10 the program crash where i wrong ? Click to expand... Do I always sign the hours with 2 digits? (type 03)
moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #3 why the dateparse not have the same problem ? Upvote 0
Jmu5667 Well-Known Member Licensed User Longtime User Jun 17, 2021 #4 how have you define the datefield in your database? Your problem is mostliky that hours less then 10 may loose the leading zero. Upvote 0
how have you define the datefield in your database? Your problem is mostliky that hours less then 10 may loose the leading zero.
moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #5 Ok the date not have the problem if in format yyyyMMdd Thanks Upvote 0
moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #6 How i do for define correctly the time field in database ? Upvote 0
Jmu5667 Well-Known Member Licensed User Longtime User Jun 17, 2021 #7 What database are you using ? Upvote 0
moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #9 but if i write in format ssmmHH work like yyyyMMdd right ? Upvote 0
moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #10 No it is the same with seconds ... Upvote 0
Jmu5667 Well-Known Member Licensed User Longtime User Jun 17, 2021 #11 you could just store the date as a long value Upvote 0
moore_it Well-Known Member Licensed User Longtime User Jun 17, 2021 #12 Yes good idea thanks very much Jmu5667! Upvote 0