SmartGWT - Display date in yyyy/MM/dd format - date

I want to have the possibility to display a date with the possibility to enter the date manually.
For this I've uset the attribute useTextField set to true like:
setAttribute("useTextField", true);
Now I want the format of date to be yyyy/MM/dd.
I've tryed with
setAttribute("displayFormat ", "TOJAPANSHORTDATE");
setAttribute("inputFormat ", "YMD");
but nothing happen.
I need to use attributes.
What attribute should I use? And with what value?
Please, need help.
Thanks you a lot.

You can try
.setDisplayFormat(DateDisplayFormat.TOJAPANSHORTDATE);

Related

Date Format - Change format of Month from String to Numeric Value

I would think this is relatively straight forward but cant find documentation on how to do it(or the correct syntax to use) and my messing around hasn't worked so far.
For Dates we have a custom format called Month /Day /Year. This pulls back a the date(as a date type) in date format as such:
"14 April 2003"
The code behind this is:
(DATEPART('year', [Close Date])*10000 + DATEPART('month', [Close Date])*100 + DATEPART('day', [Close Date]))
What I want to get back is the month is numeric format like:
"14.04.2003"
Is it simply changing the "month" part in the code to a different type? Has any one come across this?
Cheers
lampbob, I'd just use date formatting which will mean you will still be able to use all the date-fields flexibility that Tableau provides.
Select Custom format with the following input:
dd.mm.yyyy
See the screen below for more details:
This can be easily achieved using the 'Format' option in Tableau. Here are the steps to follow to format the date field as you have specified.
Add Date field to your Rows/Columns field on a Tableau worksheet.
Set the format of the Date to be DAY(Date).
Click on options for 'DAY(Date)' and go to 'Format...'
On the Format DAY(Date) panel, go to Scale -> Dates.
Select 'Custom' option and type in 'mm.dd.yyyy'. Now the date will be in the string format you need.
Screenshots:
String format for date,
Changing to 'DAY' and 'Format...'
If you are only concerned about how the date is presented, then leave the datatype as a date, and use a custom format string via the format pane to display it as desired.
Followed your advice and just had to change the date pill, in the column field, to a continuous value. Then right clicked -> format -> Scale -> custom. Then used the above suggested format setting. Thanks Petr, woodhead92.

Google sheets date format change

Google sheets default date format is 11/05/2014 I want it be like 12-Apr-2014
I already have done date format change but its not working.
Can anyone please tell me how do I change it?
Thanks
The formula would be
=TEXT(A1, "DD-MMM-YYYY")
This is considering that your date is in cell A1.

JQuery Mobile/Datebox, difference between display date format and submit date format

Is there a way to display a date in an input different from the format I want to submit.
For example I have to submit a date in "yyyy-mm-dd" format but I want to display the date in another format : "dd/mm/yyyy" (french display).
Is there a good tip to do that with Datebox for jQuery Mobile (an option I didn't see ?)
I think I have to cheat in creating an input hidden with the good form format and another one with the format to display (and not submitted), but maybe a better solution exists.
Any ideas ?
Your best bet is to indeed use 2 inputs - but, it's pretty easy to do, and using a callback on the set event, you can even make datebox do the second format for you.
http://dev.jtsage.com/jQM-DateBox2/demos/script/split.html
(Note: I just added the demo, so you didn't miss it earlier)
Just a small addition
It should be "overrideDateFormat":"%d/%m/%Y" in the HTML inline options.
In http://dev.jtsage.com/jQM-DateBox2/demos/script/split.html it states "dateFormatOverride":"%d/%m/%Y"} however this is incorrect and doesn't work. Just a heads up for anyone else with this issue.
Yes you need to use this method.
<!-- fix american date formatting -->
<script type="text/javascript">
jQuery.extend(jQuery.mobile.datebox.prototype.options, {
'overrideDateFormat': '%d/%m/%Y',
'overrideHeaderFormat': '%d/%m/%Y'
});
</script>

jquery datepicker date format with output of Zend_Locale

I'm trying to set the format for a jquery datepicker element with the date format returned by Zend_Locale::getTranslationList('date', $locale);
My problem is zend returns the string 'dd/MM/yyyy' for the date format but jquery expects only 2 characters for the year ie 'dd/mm/yy', so it enters the year twice 20112011
Is there some option that can be passed to either zend or jquery to make them work in the same manner? I've read through the docs and can't seem to find anything
Many thanks for your help in advance!
I have used jquery date picker in python-django framework when I give date format as dd/mm/yyyy format it returns 20112011 then i have corrected it to dd/mm/yy and it returned 2011 only. you can specify in your datepicker css class to specify the date format as dd/mm/yy.
Iam not sure if this is what you're looking for but:
// use german local, change it to our needs :-)
$locale = new Zend_Locale('de_DE');
$result = Zend_Locale::getTranslationList('date', $locale);
// returns dd.MM.yy (german!)
echo $result['short'];

SmartGwt DateItem useTextField=true - how to make text entry field UNeditable

Since I can't figure out how to solve my problem presented here I'm thinking for the moment at a temporary solution.
I have a smartgwt DateItem widget:
DateItem date = new DateItem("Adate");
date.setWidth(120);
date.setWrapTitle(false);
date.setAttribute("useTextField", true);
date.setAttribute("inputFormat", "yyyy/MM/dd");
date.setAttribute("displayFormat", "toJapanShortDate");
Because the attribute useTextField is set to true we can see the text entry field. How can I make this text entry field to be uneditable.
Actually I want to have only the possibility to choose the date from calendar and not to change it manually.
Resolved - the issue exposed above - thanks to #RAS user.
TextItem textItem = new TextItem();
textItem.setAttribute("readOnly", true);
date.setAttribute("textFieldProperties", textItem);
Related link
But I have now another issue (resolved - see here):
The date chooser won't show the date on the text field but Today's date.
For example, enter 30/05/2009 on the text field, go to another field, then come back on click on the date chooser and the selected day will be Today's date instead on June 30th, 2009. Which is the reason for this? Can this be solved?
Also let's say I let to the user to opportunity to manually modify the date - can I put some **validators on it?** (still need an ideea on this)
Thank you.
date.setEnforceDate(true);
http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/DateItem.html#setEnforceDate%28java.lang.Boolean%29
You have a lot of different validators. Depending on the context it must be possible to validate cardinality, relation to other data items, datatype(not only date time values) and relations to other external records.