JavaScript, JSON, WCF, and passing dates, oh my!!!!

I spent more time than I will EVER admit trying to figure out what the heck was wrong with my code, passing a date created by the jQuery UI datepicker into my .NET WCF service. I tried tick conversions (which would wind up sending a date WCF didn’t understand). The only things I COULD get WCF to understand, read around the year 1970. So, with a bit of research, I wound up with the following code to convert a JavaScript date to a format that WCF wants to see.

$.ajax({
     type: "POST",
     contentType: "application/json; charset=utf-8",
     url: "/WebServices/WebServiceHost.svc/scorePhotographer",
     data: '{"datevisited": "\\\/Date(' + Date.UTC(x.getUTCFullYear(), x.getUTCMonth(), x.getUTCDate(), x.getUTCHours(), x.getUTCMinutes(), x.getUTCSeconds(), x.getUTCMilliseconds()) +
          (-x.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(x.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(x.getTimezoneOffset() / 60)) + '00' +
          ')\\\/" +
          '"}',
     dataType: "json",
     dataFilter: function(data, type) {
     var d = data.replace(/"\\\/(Date\(.*?\))\\\/"/gi, 'new $1');
     return d;
},
success: function (msg) {
     // blah
},
error: function (e) {
     //blah
}
});

1,683 Replies to “JavaScript, JSON, WCF, and passing dates, oh my!!!!”

  1. отель марианна сочи официальный сайт море лето
    тур выходного дня в санатории тюмени тэс отель евпатория отзывы сурож отель 3 судак
    саки санаторий им пирогова официальный сайт искра анапа официальный сайт отели в крыму с крытым бассейном

  2. отели волгограда на карте новая клиника ессентуки врачи
    белокуриха проживание недорого holiday inn калининград mriyaresort com
    туры в геленджик из барнаула в январе мрия симеиз санаторий светлана цены

  3. hilton garden inn ufa бассейн с морской водой геленджик
    пансионат айтар в сухуми пансионат солнечный солнечногорск рамада екатеринбург официальный сайт цены акции
    гостиницы в осташкове на берегу селигера ялта бристоль официальный отзывы о санатории крым в партените 2021

  4. ла ода веселый хотей гурзуф официальный
    чайка терешковой евпатория официальный сайт отель плаза геленджик анапа экскурсии ноябрь 2021
    ростов великий отели и гостиницы гостиница скайпорт санаторий беларусь официальный сайт

  5. купить путевку в санаторий заполярье парк в горячем ключе фото
    санаторий маяк анапа фото аквапарк ривьера казань отель отдых на море в калининградской области
    белоруссия мисхор отель жемчуг витязево отзывы отели московской области все включено

  6. спутник сочи официальный сайт отель в крыму в виде цветка
    отдых в отрадном крым горгиппия это детский санаторий анапа
    пансионат гагрипш абхазия гостиницы кабардинки с бассейном отели в якутске

  7. Excellent blog you have here but I was curious if you knew
    of any message boards that cover the same topics discussed in this
    article? I’d really love to be a part of online community where I can get opinions from other experienced individuals that share the same interest.
    If you have any recommendations, please let me know.

    Thank you!

  8. протон гостиница москва отели кисловодска рядом с парком с бассейном
    курьи свердловская область националь витязево официальный санаторий сана гагра
    гостевые дома в дивеево санаторий сибирь в тюмени ялта букинг

  9. отели в нижнекамске отдых в гагре
    отель алиса рубцовск гурзуф ривьера официальный санаторий авангард сочи адрес
    отдых в сочи зимой 2022 вишневая гора саратов официальный отдых лазаревском

  10. Hi would you mind letting me know which hosting company you’re using?

    I’ve loaded your blog in 3 completely different internet browsers and I must say
    this blog loads a lot faster then most. Can you suggest a good web hosting provider at a fair price?
    Cheers, I appreciate it!

  11. санаторий источник в ессентуках цены санаторий морская звезда лазаревское официальный сайт
    дальнегорск гостиница нордвест отель санкт петербург отель европа ялта
    отель марриотт эсто садок краснодар курорт лиго морская симеиз отзывы

  12. такси кропачево янгантау медовые водопады в кисловодске как добраться
    железноводск санатории крыма с лечением жкт и печени апарт отель онегин
    санаторий поляны управление делами виконда урдома гостиница телефон санаторий васильевский казань цены

  13. mriya resort spa крым официальный сайт цены анапа хуторок официальный сайт цены
    розенталь поповка крым отель самара люкс самара официальный сайт санаторий крупской анапа
    пансионат гренада ламор ibis москва центр бахрушина

  14. пансионат севастополь ялта официальный сайт веб камеры санаторий фрунзе
    отели нового афона солнечное сочи санаторий голубая даль в дивноморском
    санаторий сосны тамбов цена отели на набережной геленджика гостиница янаис

  15. гостиница адмирал в архангельске отели судака отзывы
    санаторий буковая роща санаторий адлеркурорт сочи официальный сайт оркестра горизонт геленджик резорт
    винтаж отель новый свет крым хоста санатории гостиница истра московская область

  16. гюмюльдур сухие углекислые ванны в москве
    орел отели и гостиницы ривьера каспия юдино парк
    жк эконом класса краснодар гостиницы чкаловска нижегородской области туры в абхазия

  17. ялта зоопарк сказка официальный сайт санаторий в башкирии танып официальный сайт
    анапа отель с бассейном гостиница лира в одинцово абу даги махачкала
    санаторий нехама гранд отель гагра фото отель алиса должанская

  18. [url=https://tretinointab.online/]how much is retin a prescription[/url] [url=https://zithromax.click/]azithromycin 500mg no prescription[/url] [url=https://gabapentinx.quest/]neurontin cost[/url]

  19. Hey there would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 different browsers and I
    must say this blog loads a lot faster then most. Can you recommend a good internet hosting
    provider at a honest price? Thanks a lot, I appreciate it!

  20. Hey There. I found your blog using msn. This is a really
    well written article. I’ll make sure to bookmark it and come back to read more of your useful info.
    Thanks for the post. I will definitely comeback.

  21. I savour, result in I discovered exactly what I was
    taking a look for. You’ve ended my 4 day lengthy hunt!
    God Bless you man. Have a nice day. Bye

  22. Woah! I’m really enjoying the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance” between usability and visual appeal.
    I must say you have done a amazing job with this. Also, the blog loads extremely
    fast for me on Chrome. Excellent Blog!

  23. Hey there, I think your website might be having browser compatibility issues.
    When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that,
    terrific blog!

  24. Greetings I am so grateful I found your site, I
    really found you by accident, while I was browsing on Aol for something else, Anyhow I am here
    now and would just like to say thanks for a marvelous post and a
    all round thrilling blog (I also love the theme/design), I don’t have time to look over it all at the
    moment but I have book-marked it and also added in your RSS feeds,
    so when I have time I will be back to read much more, Please do keep up the excellent work.

  25. Wow, incredible weblog format! How long have you been blogging for?
    you make blogging look easy. The overall look of your website is great, let alone the content!

  26. Hey just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Opera.
    I’m not sure if this is a format issue or something to do with internet browser compatibility but I figured I’d post to
    let you know. The style and design look great though!
    Hope you get the problem fixed soon. Kudos

  27. I blog frequently and I seriously appreciate your content.
    The article has truly peaked my interest. I’m going to
    book mark your site and keep checking for new information about once a week.

    I opted in for your Feed as well.

  28. Greetings from Florida! I’m bored to death at work so I decided to check out your blog on my iphone during lunch
    break. I enjoy the information you provide here and can’t wait to take a look when I get home.

    I’m amazed at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyways, superb blog!

  29. You really make it seem so easy with your presentation but I find this
    matter to be really something which I think I would never understand.
    It seems too complicated and very broad for me. I am looking forward for your next post, I’ll try to get the hang of it!

  30. Thank you for some other fantastic post. The place else
    may just anyone get that kind of information in such a perfect manner of writing?
    I have a presentation next week, and I am on the look for such information.

  31. Undeniably believe that which you stated. Your favorite reason seemed
    to be on the web the simplest thing to be aware of.
    I say to you, I definitely get irked while people think about worries that they
    plainly do not know about. You managed to hit the nail upon the top
    and also defined out the whole thing without having side effect , people could take a signal.
    Will likely be back to get more. Thanks

  32. I’m extremely impressed with your writing skills and
    also with the layout on your blog. Is this a paid theme
    or did you customize it yourself? Either way keep
    up the nice quality writing, it’s rare to see a great blog like this one these days.

  33. Thanks , I’ve recently been looking for info approximately this
    subject for a long time and yours is the best I’ve came upon so
    far. But, what in regards to the conclusion? Are you certain concerning the source?

  34. Hey are using WordPress for your site platform?

    I’m new to the blog world but I’m trying to get started and set up
    my own. Do you require any html coding expertise to make your own blog?
    Any help would be greatly appreciated!

  35. Hey There. I discovered your weblog the usage of
    msn. This is an extremely smartly written article. I will be sure to bookmark it and
    return to learn extra of your helpful information. Thanks for the post.
    I will certainly comeback.

  36. Incredible! This blog looks just like my old one!
    It’s on a totally different subject but it has pretty much the same page layout and design. Excellent choice of colors!

  37. Today, I went to the beach with my children. I
    found a sea shell and gave it to my 4 year old daughter and said
    “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed.

    There was a hermit crab inside and it pinched her ear.

    She never wants to go back! LoL I know this is completely off topic but I had
    to tell someone!

  38. Hi there i am kavin, its my first time to commenting
    anywhere, when i read this article i thought i could also make comment
    due to this brilliant paragraph.

  39. Thanks , I’ve just been looking for info approximately this subject for a
    while and yours is the best I have discovered till now.
    But, what about the bottom line? Are you certain in regards to the source?

  40. Please let me know if you’re looking for a writer for your weblog.
    You have some really great posts and I feel I would be a good asset.
    If you ever want to take some of the load off, I’d love to write some
    content for your blog in exchange for a link back to mine.
    Please shoot me an e-mail if interested. Regards!

  41. Wow that was strange. I just wrote an really long
    comment but after I clicked submit my comment
    didn’t appear. Grrrr… well I’m not writing all that over
    again. Anyhow, just wanted to say great blog!

  42. Every weekend i used to go to see this website, as i wish for enjoyment, for the reason that this this web page conations in fact fastidious funny material too.

  43. When I originally commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get three emails with the same comment.
    Is there any way you can remove me from that service?
    Appreciate it!

  44. Good day very cool website!! Guy .. Beautiful ..
    Wonderful .. I’ll bookmark your website and take the feeds also?
    I am satisfied to search out numerous useful info right here
    within the put up, we’d like develop extra
    strategies on this regard, thank you for sharing. . . . .

    .

  45. With havin so much written content do you ever run into any issues of
    plagorism or copyright violation? My site has a lot of
    completely unique content I’ve either created myself or outsourced but it appears
    a lot of it is popping it up all over the internet without my authorization. Do you know
    any methods to help reduce content from being stolen? I’d genuinely appreciate it.

  46. Wonderful blog! Do you have any suggestions for aspiring writers?
    I’m hoping to start my own blog soon but I’m a little
    lost on everything. Would you recommend starting with a free platform like
    Wordpress or go for a paid option? There are
    so many choices out there that I’m completely confused ..
    Any recommendations? Many thanks!

  47. Spot on with this write-up, I seriously think this site needs a great
    deal more attention. I’ll probably be returning to read through more, thanks for the info!

  48. Wonderful blog! I found it while searching on Yahoo
    News. Do you have any suggestions on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get there!

    Cheers

  49. Hi, I do think this is a great website. I stumbledupon it 😉 I’m going to return once
    again since i have book marked it. Money and freedom is
    the best way to change, may you be rich and continue to help other people.

  50. Wow, awesome blog format! How lengthy have
    you ever been running a blog for? you make running a blog look easy.
    The overall glance of your site is excellent, let alone the
    content!

  51. Pretty nice post. I just stumbled upon your weblog and wanted to say that
    I’ve truly enjoyed browsing your blog posts. In any case
    I will be subscribing to your rss feed and I hope you write
    again soon!

  52. Today, I went to the beachfront with my
    kids. I found a sea shell and gave it to my 4 year old
    daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her
    ear and screamed. There was a hermit crab inside and
    it pinched her ear. She never wants to go back!
    LoL I know this is entirely off topic but I had to tell someone!

  53. Magnificent goods from you, man. I’ve understand your stuff previous to and you are just too magnificent.
    I really like what you have acquired here, really like what you are
    stating and the way in which you say it. You make it entertaining
    and you still take care of to keep it smart.
    I can’t wait to read far more from you. This is actually a
    terrific website.

  54. You’re so cool! I do not suppose I’ve read through something like
    this before. So great to find another person with a few original thoughts on this subject.
    Really.. many thanks for starting this up. This site is one thing that
    is needed on the web, someone with some originality!

  55. Do you mind if I quote a couple of your articles as long
    as I provide credit and sources back to your webpage?
    My blog site is in the very same area of interest
    as yours and my visitors would definitely benefit from a lot of the information you provide here.
    Please let me know if this ok with you. Thank you!

  56. Whats up are using WordPress for your blog platform? I’m
    new to the blog world but I’m trying to get started and create my own.
    Do you require any html coding expertise to make your own blog?
    Any help would be greatly appreciated!

  57. Hmm it seems like your site ate my first comment (it was extremely
    long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to the whole thing.
    Do you have any points for first-time blog writers?
    I’d really appreciate it.

  58. I’ve been exploring for a little bit for any high quality articles or weblog posts on this sort of house .
    Exploring in Yahoo I at last stumbled upon this website.
    Studying this info So i’m glad to express that I’ve an incredibly excellent uncanny feeling I found out just
    what I needed. I most no doubt will make certain to don?t disregard this website and
    provides it a glance regularly.

  59. Good day! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying to get my blog to
    rank for some targeted keywords but I’m not seeing very good results.

    If you know of any please share. Thank you!

  60. Heya i am for the first time here. I found this board and I
    find It really useful & it helped me out much.
    I hope to give something back and aid others like you aided
    me.

  61. Wonderful blog! I found it while surfing around on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!
    Thank you

  62. Hello there! Do you know if they make any
    plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results.

    If you know of any please share. Kudos!

  63. Thanks for your marvelous posting! I actually enjoyed reading it, you are
    a great author. I will be sure to bookmark your blog and will eventually come back sometime
    soon. I want to encourage continue your great writing, have a nice holiday weekend!

  64. Hiya very nice blog!! Guy .. Excellent .. Superb .. I’ll
    bookmark your blog and take the feeds additionally? I am satisfied to
    find so many helpful information right here within the post, we want work
    out extra techniques in this regard, thanks
    for sharing. . . . . .

  65. Fantastic beat ! I wish to apprentice even as you amend your site, how can i
    subscribe for a blog web site? The account aided me a acceptable deal.
    I were tiny bit acquainted of this your broadcast provided shiny transparent concept

  66. Hello, i read your blog from time to time and i own a similar one and i was
    just curious if you get a lot of spam comments? If so how do you protect against it,
    any plugin or anything you can suggest? I get so much lately it’s driving me crazy so
    any support is very much appreciated.

  67. Write more, thats all I have to say. Literally, it seems as though
    you relied on the video to make your point.
    You definitely know what youre talking about, why waste your intelligence on just posting videos
    to your weblog when you could be giving us something enlightening to read?

  68. Howdy! This is kind of off topic but I need some guidance from an established blog.
    Is it difficult to set up your own blog? I’m not very techincal but I can figure things out
    pretty quick. I’m thinking about making my own but I’m not sure where to start.
    Do you have any points or suggestions? Thanks

  69. You actually make it seem so easy with your presentation but I find this
    topic to be actually something that I think I would never understand.
    It seems too complicated and extremely broad for me. I’m looking forward for your next post, I will try to get
    the hang of it!

  70. Hi, I do think this is a great web site. I stumbledupon it
    😉 I may return yet again since i have book marked
    it. Money and freedom is the greatest way to change, may you be rich and
    continue to guide other people.

  71. This is really interesting, You’re a very skilled blogger.
    I’ve joined your rss feed and look forward to seeking more of your fantastic post.
    Also, I have shared your web site in my social networks!

  72. After I initially commented I appear to have clicked on the -Notify me when new comments are
    added- checkbox and from now on whenever a comment
    is added I get 4 emails with the exact same comment.
    Perhaps there is an easy method you can remove me from that service?
    Thank you!

  73. Hmm it looks like your site ate my first comment (it was super long) so I guess
    I’ll just sum it up what I had written and say, I’m thoroughly enjoying your
    blog. I too am an aspiring blog writer but I’m still new to everything.
    Do you have any helpful hints for beginner blog writers?

    I’d really appreciate it.

  74. Hi! I’ve been reading your blog for some time now
    and finally got the courage to go ahead and give you
    a shout out from Huffman Tx! Just wanted to tell you keep
    up the great work!

  75. I would like to thank you for the efforts you have put in penning this blog.
    I am hoping to view the same high-grade blog posts from you later on as well.
    In truth, your creative writing abilities has motivated me to get my own site
    now 😉

  76. Hola! I’ve been reading your weblog for a long time now and finally got the
    courage to go ahead and give you a shout out from Austin Texas!
    Just wanted to tell you keep up the great work!

  77. Hello! I just wanted to ask if you ever have any
    trouble with hackers? My last blog (wordpress)
    was hacked and I ended up losing many months of hard work due to no backup.
    Do you have any solutions to prevent hackers?

  78. Do you mind if I quote a few of your posts as long as I provide credit and sources back to your
    webpage? My website is in the very same area of interest as yours and my visitors would
    truly benefit from some of the information you present
    here. Please let me know if this okay with you.
    Thank you!

  79. It’s the best time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I desire to suggest you
    some interesting things or advice. Maybe you could write next articles referring to this article.
    I desire to read even more things about it!

  80. Appreciating the hard work you put into your site and detailed information you provide.
    It’s nice to come across a blog every once in a while that
    isn’t the same out of date rehashed information. Great read!
    I’ve bookmarked your site and I’m adding your RSS feeds
    to my Google account.

  81. It’s a pity you don’t have a donate button! I’d definitely donate to this
    brilliant blog! I suppose for now i’ll settle for bookmarking and adding
    your RSS feed to my Google account. I look forward to fresh updates and will share this blog with my Facebook group.
    Chat soon!