web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

ODATA Get DateTime Year

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I have a javascript code which gives me records as query result with SDK.REST.retrieveMultipleRecords

One of the field I want to query is a DateTime field.

If I try to read the field value, I got this string value:

Fri Jul 17 2015 08:30:26 GMT+0200 (W. Europe Daylight Time)

How can I get the year, month, and day of the field instead this string format ?
Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Royal King Profile Picture
    27,686 on at

    use below method to parse odata date time to datetime

    var datetime  = new Date( parseInt( dt.replace(“/Date(“, “”).replace(“)/”, “”) ,10))

    Or

    new Date(DateField.match(/\d+/)[0] * 1)  // replace  DateField with your field name that holds datetime value in odata format

  • Community Member Profile Picture
    on at

    Hi Chitra,

    im on javascript

  • Community Member Profile Picture
    on at

    I see.

    My problem was that the object was stored in an associative array and somehow I couldnt execute those function. Now I have copief the value to a variable and can then successfuly access those function.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans