Gravatar for

Question by dkchittimilla, Apr 25, 2017 3:23 PM

Date field value - Parsing in javascript


We have a computed field for date and after indexing, the value for date field is coming like below.

Ex: 1423803600000

We are not sure which format this is, it is showing 13 characters. We would like to parse this format to dd/MM/YYYY using javascript. Could you please let us know how to format this string.


Gravatar for

Comment by gminero, Apr 25, 2017 3:37 PM

fyi - that number is a Unix Timestamp, you can view its "human readable date" here:

2 Replies
Gravatar for

Answer by Simon, Apr 25, 2017 3:35 PM


Here is how to build a Date Computed field:

The most important element is the Return Type.

    public string ReturnType
        get {
            return "datetime";
        set {
Gravatar for

Answer by François Lachance-Guillemette, Apr 25, 2017 3:41 PM

You should be able to parse it in JavaScript using `new Date(timestamp)` and converting this date into any format you want.

The framework also provides a helper function date if you are trying to render this field in an underscore template.

Ask a question