33

Since your "today" variable is a JavaScript date object, you can get the string representation by calling the toISOString() method. ...$filter=StartDate ge datetime'" + today.toISOString() + "' and ...


17

You can use one of the SPUtility.ParseDate overloads. Check the article Converting Date and Time Values for more details.


14

In 2010 Go to http://centraladminsite/_layouts/regionalsetng.aspx and change in there. This is hidden by default, but is part of the standard regional site settings.


14

ASP.NET AJAX (which is a part of SharePoint - MicrosoftAjax.js) extends the JavaScript Date object with a formatting function that closely mimics the DateTime.ToString method So, in your case the format string should be as follows: dd MMM yyyy, hh:ss var modified = item.get_item("Modified"); var fmtModified = modified.format('dd MMM yyyy, hh:ss'); For a ...


14

I answered the question here (not exactly a duplicate, since that was in regards to the Search REST API, and I happened to give an answer for basic REST). Here is how you filter dates in REST: $filter=StartDate ge datetime'2014-01-01T00%3a00%3a00' This filters for items created after 01-Jan-2014, 00:00:00. So to filter between two date ranges, simply add ...


13

Although it is not mentioned directly in the MSDN documentation, the <Now/> element only takes effect when used inside the DateRangesOverlap element. Please have a look at the CAML example given in both links. When used outside the tags, where you would normally use a <Today/> or a <Month/> element, SharePoint simply ignores it which makes ...


12

You need to format the date like this: Server Site string date = SPUtility.CreateISO8601DateTimeFromSystemDateTime(inputDate); Sample for your case: inputDate = new DateTime(2016,04,18); string date = SPUtility.CreateISO8601DateTimeFromSystemDateTime(inputDate); Client Side (client object model) string date = inputDate.ToString("yyyy-MM-ddTHH:mm:ssZ");...


10

You could utilize Regional Settings REST endpoint: /_api/web/RegionalSettings/TimeZone to retrieve SharePoint Time Zone settings and then get time for that time zone: function getSPCurrentTime(webUrl) { return $.ajax({ url: webUrl + "/_api/web/RegionalSettings/TimeZone", method: "GET", headers: { "Accept": "application/json; ...


10

Date columns are essentially numbers starting at 30/12/1899 So besides adding one day, you have to display it as a date again (when using it in a Calculated Column datatype=Text) =TEXT( [Due Date]+1 , "dd/mm/yyyy" ) Or set the datatype of the Calculated Column to Date =[Due Date]+1 Adding one day correctly counts the new date =TEXT(DATE(2015,12,31+1),"...


10

Try the following formula =TEXT(Created-Closed,"h") [Output] In case you need to show the exactly Hours and minutes, try this =TEXT(Created-Closed,"hh:mm") [Output] Regarding Days and Hours and Minutes, try the below one =DATEDIF(Created,Closed,"d") &" days .."& TEXT(Created-Closed,"hh:mm") [Output]


9

Date and time OData functions: day() month() year() hour() minute() second() does not seem to work with SharePoint 2013 REST Service Error: The query is not valid But you could consider the following approaches. Option 1 Utilize SharePoint 2010 REST endpoint: /_vti_bin/listdata.svc/ListName?$filter=month(<DateColumn>) eq <MonthNumber> ...


8

You have to convert your DateTime object to a ISO8601 format. You can use the SPUtility class. I always use the U2U Caml Query builder to test my queries.


8

Assuming the field type of "validfrom" is DateTime then there should be no need to convert the value, only cast it. You only need to convert/parse if your field type is text, in which case you may consider switching your type to a DateTime or use Marek's advice for conversion. DateTime validFrom = (DateTime) item["validfrom"];


8

Modify your CAML Query to <Value IncludeTimeValue='TRUE' Type='DateTime' StorageTZ='TRUE'>2018-06-28T07:07:09Z</Value> Here, we have added the StorageTZ=TRUE attribute which tells SharePoint to do the comparison using the native storage time zone (UTC time) of the field value since all time values of date time fields are stored using UTC time.


7

I tried logging the date string values before executing the creation of the listitem in the "Project Scheduling" calendar but the workflow would error without logging. Then I removed the listitem creation part and the logging worked. It was there that I noticed that the date values were set to 1/1/0001 12:00:00 AM. I found the same problem on Cliff ...


7

The point is that formula expression is usually language dependent. For example, is site locate is set to 1033 (English - United States), then the formula you have provided in the question is absolutely correct: Syntax: TEXT(value,format_text) Source But let's say the site locate is set to 1049 (Russia), in that case the proper syntax would be: ТЕКСТ(...


6

It turns out, there is no simple way to achieve this. However, I can suggest at least three quite acceptable approaches. 1 - "This Year Birthday" calculated column You can consider creating "This Year Birthday" calculated field, use it in the CAML query and compare to <Today /> element: <Eq><FieldRef Name='ThisYearBirthday' /><Value ...


6

In the Default option you can use [Today] plus some number of days... you would have to find the weekday as an integer, compare it to the weekday of Today as an integer, and do some math to get something to add to [Today] to make it next Friday. I'll see if i can find the right formula for it in the mean time. Edit: ok so you can use WEEKDAY([Today]) to ...


6

You can change the Central Admin Time Zone from here: Central Admin -> Application Management -> Manage Web Applications -> SharePoint Central Administration v4 (The Central Admin Web Application) -> General Settings -> Default Time Zone


6

Try item["Modified"] = null; That should make the Date/Time field empty.


6

This is a known issue with Workflow Manager: If the permissions of a workflow scope are set to BUILTIN\Administrators, Client Applications must run using elevated permissions If the permissions of a workflow scope are set to BUILTIN\Administrators, which is the default setting, an exception similar to the following is thrown if the client application is ...


6

Yes you should get the site's TimeZone first and then convert your DateTime accordingly. function getTimeZoneAndServerDateTime() { var context = SP.ClientContext.get_current(); var web = context.get_web(); var timeZone = web.get_regionalSettings().get_timeZone(); context.load(timeZone); context.executeQueryAsync( function ...


6

It's fairly straight forward I would say. // First get your field using the title from your list $field = $list.Fields["FieldTitle"] // Alternativly you could use $list.Fields.GetFieldByInternalName("InternalFieldName") $field.DisplayFormat = "DateOnly" $field.Update() I hope this helps.


5

You are using the the today() formula, it will return that error you are talking about. For SharePoint fields you have to use now().


5

Sorry for not getting back to you sooner. I was in training and then extremely ill the last 30ish hours. Take a look at this post by Josh McCarty: http://joshmccarty.com/2011/11/sharepoint-jquery-and-fullcalendar%E2%80%94now-with-spservices/, wherein he followed some details I posted in this discussion on the SPServices codeplex site: http://spservices....


5

Can't you just set the default value for the field to be [Today]? You'll also need to utilize the PreSaveAction to reenable the Odate column or it won't get saved. http://wael-abbas.blogspot.com/2009/02/sharepoint-presaveaction.html


5

Per Jakobsen has a very nice solution. You don't need to "muck up" anything, Chris! The only thing I have to add is to show how the REST url can be automated. Look at this: var date = new Date(), //or some relevant date filterFormat = "$filter={0} gt datetime'{1}'", filterQuery = String.format(filterFormat, "Created", date.toISOString()), url = "...


5

You can make a calculated column, formatted as Date and Time, with a formula like this: =DATE(YEAR([Start Date])+1,MONTH([Start Date]),DAY([Start Date]))


5

For full explanation see Dealing with Multiple Time Zones in SharePoint 2010 var user = SPContext.Current.Web.CurrentUser; // Always perform a Null-Check on SPUser.RegionalSettings if (user.RegionalSettings != null) { return user.RegionalSettings.TimeZone.UTCToLocalTime(listDateUtc); } else { // User didn't set a time zone, so use the one from the ...


Only top voted, non community-wiki answers of a minimum length are eligible