Android Question Set date from and to

BarryW

Active Member
Licensed User
Longtime User
Hello masters, i am working on my database and i want to select only my data(s) by simply chosing the start date and the end date. Is there any date dialogs that i can use to select the date from and the date to? Iknow there is already a date dialog but i can only select 1 date. Also is there any way to modify that? Sorry for my english hope you understand. Tnx!
 

mangojack

Expert
Licensed User
Longtime User
Welcolm to b4A ...One approach would be 2 labels with text 'From .. ' & 'To ...' with a click event to display AnotherDatePicker .. (see above Similar threads).
This might also work with Date Dialogue ,but having never used it I cant comment.
A Flag variable would determine which label is updated.
you would have to do some date checks to validate correct date choices / spread.
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
Welcolm to b4A ...One approach would be 2 labels with text 'From .. ' & 'To ...' with a click event to display AnotherDatePicker .. (see above Similar threads).
This might also work with Date Dialogue ,but having never used it I cant comment.
A Flag variable would determine which label is updated.
you would have to do some date checks to validate correct date choices / spread.

Hi:

If you're using a database like MySQL or SQLite, you can use SQL sentences, some like :

"SELECT ...... FROM database WHERE database.date > 'YYYY-mm-dd' OR database.date <'YYYY-mm-dd' "

This one queries the database to retrieve only the stated registers where the date is between the dates.

For the exact SQL syntax, query google or the b4a forum


Hope this helps ...
 
Last edited:
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Barry ... was doing nothing and wanted to learn a bit about AnotherDatePicker.
this is a basic display that allows user to choose 2 dates .. which can then be used for your SQL select statements.
at present the only check that is done is that the second date is Not older than the first date.
obviously other checks would have to be performed.

You might find it useful.

p.s. the selected dates are stored as Long so you would have to format to suite your SQL date data.
 

Attachments

  • Pick2Dates example.zip
    14.7 KB · Views: 118
Last edited:
Upvote 0
Top