Select to view content in your preferred language

Date Format for Field in Search Widget

4842
2
Jump to solution
04-27-2015 12:42 PM
AlexanderMcKoy
Deactivated User

I am configuring the .xml code for the Search widget to work for my web app.  I need help formatting a Date field.  Inside the web app, it displays with the following format:  Day Month Date Year HH:MM:SS AM/PM (see snapshot below).  Essentially, I just want the short date format as shown: MM/DD/YYYY.  I do not need the time.   I have tried the code shown below, but it does not truncate the date:

<field name="INSTALLDATE" alias="Install Date"/>

     <format precision="-1" usethousandsseparator="false" useutc="false" dateformat="M/D/YYYY"/>

</field>

Any ideas what I need to change/add to get the format I want?

SearchWidget_DateFormat.PNG

0 Kudos
1 Solution

Accepted Solutions
PhilipSlater
Deactivated User

Alexander -

If you are using the default Search Widget in Flex the data field can be displayed as:

dateformat—Format in which the date is displayed. Default is a full date and time in the user's locale using date.toLocaleString(). Example date formats include YYYYMMDD, MMMM, YYYY, J:NN:SS, EEEE, MMM. D, YYYY at L:NN:QQQ A. See DateFormatter documentation for a full description.

I would suggest trying MM/DD/YYYY to see if that works. Also, here is the documentation for the Search Widget - that may end up being helpful as well.

ArcGIS Viewer for Flex

View solution in original post

2 Replies
PhilipSlater
Deactivated User

Alexander -

If you are using the default Search Widget in Flex the data field can be displayed as:

dateformat—Format in which the date is displayed. Default is a full date and time in the user's locale using date.toLocaleString(). Example date formats include YYYYMMDD, MMMM, YYYY, J:NN:SS, EEEE, MMM. D, YYYY at L:NN:QQQ A. See DateFormatter documentation for a full description.

I would suggest trying MM/DD/YYYY to see if that works. Also, here is the documentation for the Search Widget - that may end up being helpful as well.

ArcGIS Viewer for Flex

AlexanderMcKoy
Deactivated User

I needed to remove some of the unnecessary code, but once this was done, the "dateformat" tag worked with the formatting exactly as you described.  Thanks.

0 Kudos