Recent

Author Topic: How to reset TDBDateTimePicker?  (Read 620 times)

loaded

  • Hero Member
  • *****
  • Posts: 825
How to reset TDBDateTimePicker?
« on: May 30, 2022, 01:43:19 pm »
Hi All,
In my current database, records with date type initially show as "00.00.0000". So far, no problem.
However, after a change in the relevant record, it is not possible to revert the date to "00.00.0000".
I can do this with SQL. But is it possible to reset it directly via TDBDateTimePicker?
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

rvk

  • Hero Member
  • *****
  • Posts: 6169
Re: How to reset TDBDateTimePicker?
« Reply #1 on: May 30, 2022, 02:01:17 pm »
In my current database, records with date type initially show as "00.00.0000". So far, no problem.
However, after a change in the relevant record, it is not possible to revert the date to "00.00.0000".
I can do this with SQL. But is it possible to reset it directly via TDBDateTimePicker?
00.00.0000 isn't a valid date, is it?

Why are you not working with NULL for empty or unspecified dates in your database?

It is possible to set a TextForNullDate. You could set it to 00.00.0000.
But before writing it to the database you would need to change the NULL-value to 00.00.0000.
( or better yet, switch to null on screen and in the database )

O wait. That's TDBDateEdit. With TDBDateTimePicker you can't enter an invalid date, period.
O, but you can set it to NULL.

« Last Edit: May 30, 2022, 02:07:49 pm by rvk »

loaded

  • Hero Member
  • *****
  • Posts: 825
Re: How to reset TDBDateTimePicker?
« Reply #2 on: May 30, 2022, 07:20:30 pm »
First of all, thank you very much for your reply Rvk.
00.00.0000 isn't a valid date, is it?
Yes, it is not a valid date. It just helps me perceive it visually faster.

What I'm wondering is why TDBDateTimePicker can show the invalid date initially, but not the same value afterwards?

Why are you not working with NULL for empty or unspecified dates in your database?
I think it would be better if I did as you said. Respects.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

 

TinyPortal © 2005-2018