Select to view content in your preferred language

Pop up showing Date/Time Field as whole numbers

3997
8
Jump to solution
07-12-2012 12:59 PM
NancyGnanicys
Deactivated User
I am using the ArcGIS Viewer for Flex v3.0, and noticed an interesting conversion of the date and time field when brought into the pop up.

The data was brought in originally via an excel file that had GPS coordinates on it.  Then the data was displayed using the XY coordinates in arcmap and converted into a feature class.  The field properties show the type as 'date' and in the attribute table also show in the format mm/dd/yy and x:xx:xx for the time.  Using the pop up configure button found under the maps tab> editing the operational layer I am using> and then configure pop up. 

Interestingly, the data seems to get lost in translation somewhere but I do not know how this can be resolved and was hoping someone had an idea for a fix.  The pop up for the date appears as random numbers that don't even correspond to the date.  For example 7/5/2012 shows up in the pop up as 134147920000000 and the time for 12:24:00 shows up as -2209117491000.  Where are these weird conversions coming from?  Anyone?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ZahidChaudhry
Deactivated User
I have the exact same problem! I hope someone knows the answer. I did a temporary work around by using the year only (ex: 2012), no month and day with slashes.

you need to configure your date field and to get what you are looking for...

Here is how you can configure, date field in popUpconfig.xml...

How to format dates and numbers. See API Reference for more details. This tag has the following attributes:

  • dateformat???Can be set to either one of the constants below or a DateFormatter formatString like YYYY-MM-DD. Optional. The default is "shortDateShortTime".


    • "dayShortMonthYear"???for example, "21 Dec 1997"

    • "longDate"???for example, "Sunday, December 21, 1997"

    • "longMonthDayYear"???for example, "December 21, 1997"

    • "longMonthYear"???for example, "December 1997"

    • "shortDate"???for example, "12/21/1997"

    • "shortDateShortTime"???for example, "12/21/1997 6:00 PM". This is the default.

    • "shortDateShortTime24"???for example, "12/21/1997 18:00"

    • "shortMonthYear"???for example, "Dec 1997"

    • "year"???for example, "1997"

View solution in original post

0 Kudos
8 Replies
TimHayes
Frequent Contributor
I am using the ArcGIS Viewer for Flex v3.0, and noticed an interesting conversion of the date and time field when brought into the pop up.

The data was brought in originally via an excel file that had GPS coordinates on it.  Then the data was displayed using the XY coordinates in arcmap and converted into a feature class.  The field properties show the type as 'date' and in the attribute table also show in the format mm/dd/yy and x:xx:xx for the time.  Using the pop up configure button found under the maps tab> editing the operational layer I am using> and then configure pop up. 

Interestingly, the data seems to get lost in translation somewhere but I do not know how this can be resolved and was hoping someone had an idea for a fix.  The pop up for the date appears as random numbers that don't even correspond to the date.  For example 7/5/2012 shows up in the pop up as 134147920000000 and the time for 12:24:00 shows up as -2209117491000.  Where are these weird conversions coming from?  Anyone?


I have the exact same problem! I hope someone knows the answer. I did a temporary work around by using the year only (ex: 2012), no month and day with slashes.
0 Kudos
ZahidChaudhry
Deactivated User
I have the exact same problem! I hope someone knows the answer. I did a temporary work around by using the year only (ex: 2012), no month and day with slashes.

you need to configure your date field and to get what you are looking for...

Here is how you can configure, date field in popUpconfig.xml...

How to format dates and numbers. See API Reference for more details. This tag has the following attributes:

  • dateformat???Can be set to either one of the constants below or a DateFormatter formatString like YYYY-MM-DD. Optional. The default is "shortDateShortTime".


    • "dayShortMonthYear"???for example, "21 Dec 1997"

    • "longDate"???for example, "Sunday, December 21, 1997"

    • "longMonthDayYear"???for example, "December 21, 1997"

    • "longMonthYear"???for example, "December 1997"

    • "shortDate"???for example, "12/21/1997"

    • "shortDateShortTime"???for example, "12/21/1997 6:00 PM". This is the default.

    • "shortDateShortTime24"???for example, "12/21/1997 18:00"

    • "shortMonthYear"???for example, "Dec 1997"

    • "year"???for example, "1997"

0 Kudos
DavidBrooks3
Deactivated User
I am using the ArcGIS Viewer for Flex v3.0, and noticed an interesting conversion of the date and time field when brought into the pop up.


In the popup xml file you want to do the following:

<configuration>
    <title>{NAME}</title>    
    <fields>
     <field name="TRACK_DATE">
        <format dateformat="shortDateShortTime"/>
    </field>    
</configuration>
0 Kudos
NancyGnanicys
Deactivated User
Interestingly enough it is still not showing up with the reformatted code, however I think that it may have been because the fields were in two separate fields in "date" type, rather than string.  SO I merged the two fields into one in a new field I created with "text" type rather than date and was able to use the field without putting in the format date code. 



<?xml version="1.0" ?>
<configuration>
    <title>Vehicle {UnitName}</title>
    <description><![CDATA[IGNITION STATUS:    {IgnitionText}
TEST DATE: {Date_} {Time_}
<format dateformat="shortDateShortTime"/>
]]></description>
</configuration>

In my rest services the Fields is showing as follows:
http://maps.cityofbowie.org/ArcGIS/rest/services/CommunityServices/Code_Enforcement/MapServer/0
Date_ (Type: esriFieldTypeDate, Alias: Date_, Length: 36 )
Time_ (Type: esriFieldTypeDate, Alias: Time_, Length: 36 )

Of course if you look further down the list there is a new field I ended up creating as my temporary work around, which is what I am currently using to display the date and time in the format I would like rather than whole number conversions that tell nothing about the date, but ultimately I would like to be able to use the date and time field in order to query.  Any ideas or confirmations as to field types getting in the way of this?
Date_Time (Type: esriFieldTypeString, Alias: Date_Time, Length: 50 )
0 Kudos
DasaPaddock
Esri Regular Contributor
Try it like this:

<?xml version="1.0"?>
<configuration>
    <title>Vehicle {UnitName}</title>
    <description><![CDATA[IGNITION STATUS: {IgnitionText} 

DATE:  {Date_}{Time_}

LOCATION: {Address}, {City} {Zip}

DIR: {Dir} SPEED: {Speed} MILES: {Miles} 

]]></description>
    <fields>
        <field name="Date_">
            <format dateformat="shortDateShortTime"/>
        </field>
    </fields>
</configuration>
0 Kudos
RichardLittlefield
Frequent Contributor
I have this problem as well.

So I have a feature class that had a date field in it. When this date field got populated it shows them like this, "11/13/12 11:23:57".

I am now creating a web map using the ArcGIS Viewer for Flex, when I go into the configuration of the pop-up window I have the simple script of "<b>Date Collected: </b>{DateCollected}" along with listing a bunch of other fields. DateCollected is the field name. Then when I go to view this in the map is lists the "Date Collected: 1332340861000"

I understand that I need to tell it to put that field in a particular format, I would like ShortDateShortTime. I just don't understand how to accomplish that. I have no html language/code experience and am learning as i go. The whole number is displays doesn't even look close to the date and time numbers. How do I get my date field to display correctly?
0 Kudos
JasonNielsen
Regular Contributor
I have this problem as well.

So I have a feature class that had a date field in it. When this date field got populated it shows them like this, "11/13/12 11:23:57".

I am now creating a web map using the ArcGIS Viewer for Flex, when I go into the configuration of the pop-up window I have the simple script of "<b>Date Collected: </b>{DateCollected}" along with listing a bunch of other fields. DateCollected is the field name. Then when I go to view this in the map is lists the "Date Collected: 1332340861000"

I understand that I need to tell it to put that field in a particular format, I would like ShortDateShortTime. I just don't understand how to accomplish that. I have no html language/code experience and am learning as i go. The whole number is displays doesn't even look close to the date and time numbers. How do I get my date field to display correctly?


If you are trying to format the date in the Description tag try this to get the short date.
<description><![CDATA[<b>Date Collected: </b>{DateCollected}]]></description>
<fields> 
    <field name="DateCollected" alias="Date Collected" visible="false">
        <format dateformat="shortDateShortTime"/>
    </field>
</fields>


I believe that is how i resolved the date in the popup.
0 Kudos
RichardLittlefield
Frequent Contributor
If you are trying to format the date in the Description tag try this to get the short date.
<description><![CDATA[<b>Date Collected: </b>{DateCollected}]]></description>
<fields> 
    <field name="DateCollected" alias="Date Collected" visible="false">
        <format dateformat="shortDateShortTime"/>
    </field>
</fields>


I believe that is how i resolved the date in the popup.


Hmm, still doesn't work. If I copy and paste your code in I get a "TypeError: Error #1088" Which could just be a typo, but not sure. Can you explain the differences between desciption and field? Or why I have to use them?

All I would like to do is list my attribute fields in the pop up window, which I can do without all the desciption and field code. Just the date field isn't coming over properly.

Attached in the word document is a screenshot of my Popup Configuration Window and one of the actual pop up.
0 Kudos