ParseDate Question

When it comes to date, I display them in SQLDate format (YYYY-MM-DD).

I used (or tried to use) ParseDate long time ago and from time to time I forgot why I left it.

Minutes ago, I used it and it does not works (my fault). After a while, I checked in the LR why it does not works and I dleted these lines to use a three lines set up date from the Listbox and it do the job.

My question is:

How do you use ParseDate (if you sold your software internationally) ?

ParseDate is limited in that it parses only a specific series of date formats, and may not be able to directly deal with data entry that would normally be considered to be a valid date. To that end, I have my own super class to handle dates (which internally does use ParseDate when possible).

The biggest caveat with dates is … “01-02-03”
is that Jan 3rd? or Feb 1st?

Maybe you like to check ParseDateMBS function in MBS Plugins to parse the date with given format?
There you can specify locale, so you can use setting for various countries.

there in lies the problem… many times you do not KNOW how the user entered the date

Hi Dave,

Thank you for your answer.

Part 1: that is why I asked this question :frowning:

Part II ( “01-02-03” ):
You are correct too. I resolved this question with a deep scan of the dates, but there must be far more than two or three dates to be sure of where dates atoms are in the string (Year, Month, Day)

All: when I was a youngster, I recall things fast and ost of the time reliably. But now that I am an oldster, I tend to forgot things fast (too fast). So, from time to time I forgot why I do things like I do; as an example, why I stop to use the ParseDate Method.

As a developer, I was asking myself how a software can deal with “Friday, December 24th, 2017” or “Vendredi 17 dcembre 2017” (when the locales are that) using ParseDate. Also, how can I place a so large text in two Dates columns (Start and End dates, in a project) in a Listbox, even with only5 or 6 columns

Sorry to bother you (reader), I am only crying in the desert. Or I may be wrong in the first place: always use what you know is better for you (sometimes you do not even know how to do it!).

As a user, I too have troubles with dates: the EyeTV software use short date (localized versions): Jan thru Dec (curiously, these are the same as in English).

Yes it is.
In my case, I know, I assume that I know, my software allow the user to put / set the dates in the SQLDate format. But will (s)he do that ?

Doh ! Another bunch of tests to add ! :frowning:

make a preference panel in your software, asking the user how he intend to enter dates.
you can have a french speaking user, using a french OS, and that enters the dates in an international system in US mode.

Is it not possible to force the user to enter the date in a certain (fixed) format by using a textfield for the day, another for the month and another for the year ?

You fix it in the ui
That way you just don’t give the chance to enter unsupported formats.

You can also create a container control and you are all set. Forget about the problem.

Youcan set a Mask, but you cannot - for number from 1 thru 12 - enforce the Day and Month #.

What I’ve done - in an application too error prone - is the useof three PopupMenus (after seen than in a Web page). No complains. I am not sure they understand how to get 2001 or 1954 from a 99 rows PopupMenu ! And they can read the month name in French (no international use for this application: only French language !)

I also created a “Calendar” window to choose the Day (a click in the window’s Listbox Cell), Month / Year (in a PopupMenu (as used widely in the Internet: Click in the Date Rectancle to choose a date…)

I do not believe there is a definitive answer.


I got an idea while writing the above answer to resolve a problem I had with my “Calendar” window: I was dealing with a PoupMenu to display Month Year values and that was bad.

I removed the PopupMenu and replaced it with a Label and display the “current” set of values (Month Year). No need to add a new Month when none was displayed (default values)…

Thanks :wink:

“simple” containercontrol with 3 items for day month and year, and a floating modal window poping when you clic on the icon.
pure xojo code, works everywhere, many languages translated, and a prfrence to ask what format you want.

Nice: I especially love the Calendar emoji: I also use it !!!

And for the dy names, I use two letters (Lu, Ma … Di) / I AlignRight the day numbers. I nearly set them Centered, but looking at your screen shot, I think that I will stay with Right Alignment.

I have also 5 RadioButtons to set the Meeting Hour (14:00, 14:30, 15:00, 15:30, 16:00).
I have a Label to report the date and time selected.

But I do not add Cancel / OK buttons Yet, nor the date / hour storage for later use. Slow work in progress here.

PS: I have a column “Child(s)” where first name and birth dates are set: the persons who enter the data are capable of everything; they enter anything with whatever format they love… Day name, etc… different separator between Records, etc. The Computer guy in charge have to check everything every week to set all dates with the same format, sometimes change the Child Name order (First Name / Family Name everywhere…).

Merci Jean-Pierre.

Here’s my window (from the running alpha application):

Work in progress.

Edit: I have to change the selected Cell Background color and the Text color (*) / shrink the width a bit. Plus buttons (Cancel / OK).

  • Corporate colors.

Of course none of these have anything to do with PARSING a date value


These are examples on how to avoid that.

Also, how a problem can give look alike solutions without contacts between the two creators.