- OutSystems.com
-
My Platform
- Community
Log in
Sign Up
![]() |
有腹肌的豆腐 · Preserving time-date ...· 1 月前 · |
![]() |
大力的饺子 · 如何在Java应用中使用JDBC连接Post ...· 1 月前 · |
![]() |
豪爽的麦片 · Out of date ...· 2 周前 · |
![]() |
伤情的遥控器 · 计算并显示特定日期值 | ...· 2 周前 · |
![]() |
骑白马的大熊猫 · Canvas Group ...· 3 月前 · |
![]() |
幸福的开水瓶 · No module named ...· 4 月前 · |
![]() |
活泼的铁链 · Sudo bench setup ...· 5 月前 · |
![]() |
眉毛粗的水桶 · 三版《天龙八部》,有一版热播全仰仗女明星|1 ...· 6 月前 · |
![]() |
冷冷的板凳 · Dinsight实时风控引擎 - 顶象· 8 月前 · |
I need to use the format 30-Aug-2013 in my application.
I am successful in displaying the date in 30-Aug-2013 format when I fetch the date saved in database.
The issue is when I select the date in Input box using Input_calender rich widget.
I setup the date format property "%d-%b-%Y" in calender widget which does display the dates in required format however the datatype changes to text and I get an error that date required while saving the data.
The texttodate function doesn't help as it requires text in YYYY-MM-DD format.
Can someone help here please.
You can also change the 'default date display' in service center (administration -> environment configuration), have you already done this?
Kind regards,
Evert
Thank you for you reply. However, Service center doesn't allow to change the date format to DD-Mon-YYYY (23-Aug-2013)
If we could do that than it would be great. Please suggest
Ahh now it becomes clear. The dateFormat is the dateformat which you have set in the RW calender widget. Then the widgets converts the selected date to text. That text is displayed in the input box and that text should be converted to a date.
Sounds hard, don't know about a function which converts the month to a number from the name (since it would also depends on the selected language).
Is it really needed that when a user selects a date, its shown as 23-Aug-2013? There where you can edit it you can display it as: DD-MM-YYYY and in the lists/show screen you can convert it using the PrettyDateFormat() action?
Kind regards,
Evert
Indeed it's difficult and we tried following approach. But it has some issue too.
Date format is set to DD-Mon-YYYY in RW calender widget.
On Save, we call an action to do following:
Input -> Date in text format (DD-Mon-YYYY)
Local variables - Day, Month, Year
Day = Substr(Date,0,2)
Year = Substr(Date,7,4)
Month = Switch loop to convert JAN to 01, FEB to 02 and so on
Output ->FormatedDate (Date Data Type) = TextToDate(Year+"-"+Month+"-"+Day)
We then assign the FormatedDate to Database variable
Test1Edit.Record.Test1.TestDate1 = FormatedDate
Execute CreateOrUpdate action
All seems good but the Edit Widget gives validation error that ‘Date Expected’
I then removed the validation (Test1Edit) from the Date Input box and date got saved in the database in date format!
I don’t understand now why the Test1Edit widget validation doesn’t recognized the FormatedDate value that we assigned before calling the CreateOrUpdate Action!
What’s wrong?
I'm guessing now so I could be wrong but could it be the client validation on the save button?
The save button in the edit record, is it on 'client and server' validation? And is the TestDate1 attribute in the EditRecord defined as a date type? If so I think the client validation (inputtype date must be date) is giving the error 'date expected', since the input has text (month) instead of a date. The browser checks the fields and the error shown. Set it on server only and it must go right.
Else: would it be possible to make an example eSpace?
Kind regards,
Evert
But below is what I did and it worked out. But not an efficient way :(
I created a local variable of text type. Assigned this variable to InputBox where date is being captured in DD-Mon-YYYY format
In the save action we assign formatted date datatype value to Database variable.
This is not giving any validation error while saving.
However, it's too much work. We have to modify the edit page also accordingly!
Any efficient way ?
Cory
how to give a condition in if statement only if the date field is entered
Hello,
With the RichWidgets 'Date_MonthName' and 'Date_PrettyFormat' actions you can modify a datetime to be written (and thus displayed) as wishfull.
Charles, don't reallyunderstand you question, what do you mean?
Kind regards,
Evert
Hi,
I also found error when using DateFormat "%d-%b-%Y" to display date with "DD-MMM-YYYY" format.
New form will display "DD-%b-YYYY" in the date field with the format above.
And for saved data will displayed as "YYYY-MM-DD" format as set in the environment.
When select the date from calendar, the format displayed correctly.
But when try to save got validation message "Date expected!".
Currently workaround using javascript in page onLoad event to fix the date format display.
And for saving data, I am using additional step in Server Action to covert the date value to "YYYY-MM-DD" format before saving.
Is it correct workaround? Or any easier way?
Thanks.
Regards,
Herry
Hi Herry,
I am having the same issue :(
When saving do you use Client & Server validation or only Server?
Can you please share the javascript in page onLoad event that you used?
Thank you in advance.
Michal
Also encountering the same issue. Our application is going to be used by both UK and US users and I need to cater for both date formats of DD-MM-YYYY (UK) and MM-DD-YYYY (US)
The right way to use format in that component is "%d-%m-%Y" using % before each format you want