DateFormat property does not seem to do anything for Input_Calendar

DateFormat property does not seem to do anything for Input_Calendar

  
I'm using the DateFormat property on an Input_Calendar widget the way I believe it should be done, but it is not working? Any suggestions would be much appreciated. Here is a couple screenshots to show you what I'm talking about:



So above you can see the format string I'm using, and below you can see the format that comes out:


I would like to see it formatted like this:  07/08/2016 8:00:00 PM

I believe there ain't no native way of doing this. You should check out the code from this extension

https://www.outsystems.com/forge/component-details/711/Date+Handling/

Or you can make your own function, getting the output from that string and checking if the hour is bigger than 12 for the AM/PM and using the mod 12 for the actual hour.
Matheus Robert wrote:
I believe there ain't no native way of doing this. You should check out the code from this extension

https://www.outsystems.com/forge/component-details/711/Date+Handling/

Or you can make your own function, getting the output from that string and checking if the hour is bigger than 12 for the AM/PM and using the mod 12 for the actual hour.
 
 I'm not sure what the point is then for having a property called "DateFormat"? If that property doesn't actually format the date. Also look at this forum post, Andre seems to indicate that using the "DateFormat" property should work:

http://www.outsystems.com/forums/discussion/16209/format-date-in-textbox-input-widget/

From what I have looked into so far that property only dictates what format the widget will put in the form when a date is selected by the end user, which in some cases will not be in the correct format that the database wants it in. In my testing the database wants it in MM-DD-YYYY HH:MM:SS or whatever format has been set for Date Format in Service Center. My thoughts right now are in your save action you would need to transform the date before saving. Likewise, when getting the date from the database you will have to transform it into the format you want to be displayed.

To answer your original question you can use this DateFormat "%m/%d/%Y %I:%M:%S %p"
Matthew Rodgers wrote:
From what I have looked into so far that property only dictates what format the widget will put in the form when a date is selected by the end user, which in some cases will not be in the correct format that the database wants it in. In my testing the database wants it in MM-DD-YYYY HH:MM:SS or whatever format has been set for Date Format in Service Center. My thoughts right now are in your save action you would need to transform the date before saving. Likewise, when getting the date from the database you will have to transform it into the format you want to be displayed.

To answer your original question you can use this DateFormat "%m/%d/%Y %I:%M:%S %p"
 
 Hey Matthew, so that is the dateformat string I'm using, but the textinput in my form does not get formatted. Also as far as the database, I guess I was thinking that Outsystems was handling the date that gets sent to the database based on the Varibale that is linked to the textinput, which in my case is a DateTime variable. So I thought that the widget was doing the converting for me. I don't do any converting, and it saves just fine in my database right now. But of course it isn't in the format I want when being rendered in the textinput. I don't want my users to have to see the date in military time in the textinput. Even the date popup window lets my end users select the date in non military (24 hour) time. So it would seem appropriate if the textinput text was also not in military time.
See my responses to yours below.
 Hey Matthew, so that is the dateformat string I'm using, but the textinput in my form does not get formatted.
The one from your screenshot isn't exactly the same as mine and may be causing syntax errors and therefore causing your text to not be formatted. Please copy and paste the one I replied with into Service Studio.
Also as far as the database, I guess I was thinking that Outsystems was handling the date that gets sent to the database based on the Varibale that is linked to the textinput, which in my case is a DateTime variable.
You are correct on that.
So I thought that the widget was doing the converting for me.
In my testing, it doesn't. Whatever you have as the DateFormat tries to get assigned to the variable. As mentioned in my previous comment, this my not be in a DateTime format that the database wants.
I don't do any converting, and it saves just fine in my database right now.
Can you re-send me the value you had in DateFormat when you were able to get it to save?
But of course it isn't in the format I want when being rendered in the textinput. I don't want my users to have to see the date in military time in the textinput. Even the date popup window lets my end users select the date in non military (24 hour) time. So it would seem appropriate if the textinput text was also not in military time. 
In my testing, the mechanics of the calendar widget are werid for my taste. Even if the Show24HourFormat property is set to false, the output will be in 24h format which is what the database wants.

Therefore, my conclusion is that you can allow the user to choose a date and time using this widget in 12h, but the format stored in the textbox must be in 24 (so whatever is in DateFormat must comply).
Matthew Rodgers wrote:

See my responses to yours below.
See my responses to yours below. Hey Matthew, so that is the dateformat string I'm using, but the textinput in my form does not get formatted.
The one from your screenshot isn't exactly the same as mine and may be causing syntax errors and therefore causing your text to not be formatted. Please copy and paste the one I replied with into Service Studio.
Also as far as the database, I guess I was thinking that Outsystems was handling the date that gets sent to the database based on the Varibale that is linked to the textinput, which in my case is a DateTime variable.
You are correct on that.
So I thought that the widget was doing the converting for me.
In my testing, it doesn't. Whatever you have as the DateFormat tries to get assigned to the variable. As mentioned in my previous comment, this my not be in a DateTime format that the database wants.
I don't do any converting, and it saves just fine in my database right now.
Can you re-send me the value you had in DateFormat when you were able to get it to save?
But of course it isn't in the format I want when being rendered in the textinput. I don't want my users to have to see the date in military time in the textinput. Even the date popup window lets my end users select the date in non military (24 hour) time. So it would seem appropriate if the textinput text was also not in military time. 
In my testing, the mechanics of the calendar widget are werid for my taste. Even if the Show24HourFormat property is set to false, the output will be in 24h format which is what the database wants.

Therefore, my conclusion is that you can allow the user to choose a date and time using this widget in 12h, but the format stored in the textbox must be in 24 (so whatever is in DateFormat must comply).
 
Hi again, see my responses below:

The one from your screenshot isn't exactly the same as mine and may be causing syntax errors and therefore causing your text to not be formatted. Please copy and paste the one I replied with into Service Studio.

I did copy and paste yours and it still does not work, the formatted string in the textinput is still military time.

Can you re-send me the value you had in DateFormat when you were able to get it to save?

I had no value in it before, it was just blank. But whether I have a value or not it still saves just fine to the database, it just doesn't format the string. I don't understand what the purpose of the "DateFormat" property is for if it has no affect on the format of the date string that shows up in the textinput. It's like the DateFormat property is comletely useless and does absolutely nothing. Maybe Outsystems removed the functionality from that property because it was causing issues when saving to the database as you mentioned, just a guess.
See my responses to yours below.
I did copy and paste yours and it still does not work, the formatted string in the textinput is still military time.
As I mentioned in my previous comment, in my opinion, this is something the users will have to live with. What they select using the widget can be in 12hr, but what the widget puts in the textbox will have to be in 24hr format.
I don't understand what the purpose of the "DateFormat" property is for if it has no affect on the format of the date string that shows up in the textinput.
It does have an effect (at least in my testing) and I can’t explain why it isn’t working for you. I've attached the app I have been using to test if you want to look at it. However, the string that shows up has to be in 24hr format according to my testing.
It's like the DateFormat property is comletely useless and does absolutely nothing
The mechanics of it are just weird and it doesn’t work like one would think.
Maybe Outsystems removed the functionality from that property because it was causing issues when saving to the database as you mentioned, just a guess.
No idea, but I believe they need to re-evaluate this widget.

At this point, I think I am out of ideas. Sorry. Maybe post on Andre’s thread? I will be here though if you have any questions for me.
Matthew Rodgers wrote:
See my responses to yours below.
I did copy and paste yours and it still does not work, the formatted string in the textinput is still military time.
As I mentioned in my previous comment, in my opinion, this is something the users will have to live with. What they select using the widget can be in 12hr, but what the widget puts in the textbox will have to be in 24hr format.
I don't understand what the purpose of the "DateFormat" property is for if it has no affect on the format of the date string that shows up in the textinput.
It does have an effect (at least in my testing) and I can’t explain why it isn’t working for you. I've attached the app I have been using to test if you want to look at it. However, the string that shows up has to be in 24hr format according to my testing.
It's like the DateFormat property is comletely useless and does absolutely nothing
The mechanics of it are just weird and it doesn’t work like one would think.
Maybe Outsystems removed the functionality from that property because it was causing issues when saving to the database as you mentioned, just a guess.
No idea, but I believe they need to re-evaluate this widget.

At this point, I think I am out of ideas. Sorry. Maybe post on Andre’s thread? I will be here though if you have any questions for me.
 Sounds good, thanks Matthew!