Tag Info

Hot answers tagged

14

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


7

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.


7

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 ...


6

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.


6

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 ...


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

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"];


5

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 ...


5

What a fun problem! For column LastMonday: =IF(WEEKDAY([Created])=1,DATE(YEAR([Created]),MONTH([Created]),DAY([Created])-6),DATE(YEAR([Created]),MONTH([Created]),DAY([Created])-WEEKDAY([Created])+2)) For column NextSunday: =IF(WEEKDAY([Created])=1,[Created],DATE(YEAR([Created]),MONTH([Created]),DAY([Created])-WEEKDAY([Created])+8)) You can do this as a ...


5

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 ...


4

Sven Gillis has the correct answer that the DateTime object needs to be in the ISO format required. I want to elaborate on why your code specifically is not working as you expected. You are concatenating the DateTime object (the output of DateTime.Now.AddDays(7)) with other string objects. This will call the default .ToString() method of DateTime. This ...


4

You can even pass the date in the format yyyy-MM-dd ... :)


4

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 ...


4

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


4

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]))


4

You'll need to use an additional XSL schema called ddwrt. Here is a blog with a good and simple walk-through <xsl:value-of select="@ArticleStartDate"/> You get back a pretty nasty looking result 2009-03-23 00:00:00 However if you use the “FormatDate” function, you can make this look a lot better. <xsl:value-of ...


4

The problem is that calculated columns don't recalculate until an item is modified. So if nobody edits an item for 3 days after post-op, your calculated column will still show 0. You have 2 options within SharePoint: either show the op date and let your users calculate it in their heads, or create views that filter into 0-1 days post-op, 1-2 days post-op, ...


3

What about approaching it from the other end of the solution? If users are clicking a link of some kind to get to this view (is it a data view web part?), you could use JavaScript (which can handle date offsets relatively easily) to append a query string with the start date and end date of the range you need, and use both of those parameters in your CAML ...


3

Edit: Doesn't actually work; possibly due to issues between <In> and DateTimes. Ready for some madness? This is an ungodly and unmaintainable solution, but it's worth it for the laugh: <In> <FieldRef Name="Birthday" /> <Values> <Value Type="DateTime" IncludeTimeValue="FALSE"> <Today ...


3

I think the date should be in Sortable DateTi­me Pattern like "2011-12-26T00:00:00". Try this String.Format("{0:s}", Date)


3

It looks like you are out of luck at least with out of the box datetime field control. A little bit of reverse engineering revealed that they dropdown values are built into the control, not exposed. You may have to write your own field control. // Microsoft.SharePoint.WebControls.DateTimeControl private string[] m_minutes = new string[] { "00", ...


3

Use something like: <xsl:value-of select="ddwrt:FormatDate(@ArticleStartDate, 1033, 3)"/> Change 1033 to you LocalID and the second number is a format specifier. See here for possible values. Make sure you have the ddwrt namespace reference xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" in the top of your xsl. See also: ...


3

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 = ...


3

When you say that it didn't work, does it fail to parse, or does it simply not match your desired data? <Value IncludeTimeValue='TRUE' Type='DateTime'><Today /></Value> should work, I tested this in a query in U2U and it worked fine. I would check <Geq> as well as <Leq> to make sure it's not an issue of timezone. SharePoint's ...


3

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 ...


3

Batman, This should help: How to Validate a Due Date in a SharePoint 2010 List In short use Column Validations in Column Settings, a short formula can be: [Due Date] > Today()


3

Microsoft Ajax library also contains Date.localeFormat Function that formats a date by using the current culture. Example: var prettyDate = originalDate.localeFormat('dd MMM yyy, hh:ss'); console.log(prettyDate);


3

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 ...


3

SP.dateTimeUtil.js provides methods for working with dates. It is not supposed to be modified since it is a part of SharePoint JS library. Consider Regional Settings to customize the calendar, time format and etc.


2

If I understand correctly, you should show last modified date of row in list view, am I right? In this case you could select List tab in the ribbon, click on modify view button, in the fields list select check box near the Modified field, click ok. This field will be added to the view.



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