Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9120931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:44:29+00:00 2026-06-17T05:44:29+00:00

I am trying to take a string’d date value from an element, and convert

  • 0

I am trying to take a string’d date value from an element, and convert it to a js var in order to use SPServices to add to a SP 2010 list (date field).

I found the date.js resource, but I am not sure how to properly use it. Everything I do that manipulates the date changes it to a string… .format() whatever.

I think I need someway to change the value into : 2013-01-01T19:20:15 in order to pass through SPServices and update the list like below:

function CreateNewItem(subject, message) {
    $().SPServices({
        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",
        listName: "Example",
        valuepairs: [["Title", subject], ["Message", message], ["DateField", date]],
        completefunc: function(xData, Status) {
          alert("completed");
        }
    });}

So I tried the Date.parse and it doesn’t like the returned value, but I am not sure how to change the returned value without making it a string?

Appreciate help as always.

EDIT: more clarification….I am using XSLT to Grab values from XML file, and creating html page for viewing the values. So with xml

<div id="thisDateExample"><xsl:value of select="thisDateExampleDate"/></div>

So then I have been trying a couple things, like getting the string value from jquery selector:

var thisDateThatIsDrivingMeCrazy = $('#thisDateExample').text();

So again, I am just learning all these things but I am thinking that made it a string, and I found the date.js to get it back to a date format I guess?

var thisDateConverted = new Date(Date.parse(thisDateThatIsDrivingMeCrazy));

Then trying to pass into SPServices? This is one approach that I guess thought made sense, but I must be doing something wrong here? If I alert this is uses a different format from what I need I believe. but again per above, anything I do to format it (or what I can find on the subject to try out) seems to change it to a string (I am assuming) and doesn’t work. help is always appreciated! Greatly!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:44:30+00:00Added an answer on June 17, 2026 at 5:44 am

    figured this out, though I think with my original question I just lacked some content. I needed to get the date formatted to ISO 8601 format for SharePoint to except it. So all I really needed was something I found here :

    function convertThisDate(thisDate){
      var myDate;
      if (thisDate!= null)  {
         myDate = thisDate;
      }
      else  {
         myDate = new Date();
      }
      var stringDate = "";
      stringDate  += thisDate.getYear() + "-";
      stringDate  += thisDate.getMonth() + 1 + "-";
      stringDate  += thisDate.getDate();
      stringDate  += "T" + thisDate.getHours() + ":";
      stringDate  += thisDate.getMinutes() + ":";
      stringDate += thisDate.getSeconds() + "Z";
      return stringDate;
    }
    

    something as simple as the above works perfect, as SharePoint seems to be very picky about the date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to take std::string value and use it as delimiter in std::getline() function
I'm trying to take a numeric value in a string and raise it by
I am trying to take a String from a JTextField using getText and apply
I am trying to take a string of text and create an array from
I'm currently trying to take a string (0.1) and convert it to a double
I'm having a weird problem, trying to take a string from a string array
I'm trying to take values from this string: -webkit-gradient(linear, right top, left top, color-stop(0,
I'm trying to take a variable (long), and convert it to a string, such
I am trying to take a data string from one column and split it
I'm trying to take a string and then retrieve the required elements from it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.