www.webdeveloper.com
Results 1 to 2 of 2

Thread: Compare date object to difficult string

  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Compare date object to difficult string

    I know yet another question this kind.Sorry ..
    But I'm not JS dev and have one time task.

    Issue is that I have one value that is returned by $(this).attr("ows_Modified"); (Sharepoint and SPService thing)
    This value seems to be string 'Fri Oct 19 2012 13:35:45 GMT+0200' need to compare it to the date object with value format like this: 2012-10-29 12:14:13 and check with one is newer.
    Any ideas how to do this please ?

    Thanks
    Evo

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    I believe what you're looking for is Date.parse().

    Code:
    var d1 = Date.parse("Fri Oct 19 2012 13:35:45 GMT+0200");
    var d2 = Date.parse("2012-10-29 12:14:13");
    if (d1 > d2) { ... }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles