Sharepoint 2013 - create a column that contain current date in sharepoint list - sharepoint

I am very new to sharepoint,
currently i am working to create a column that contains current date in sharepoint list.
the problem is i want the date automatically change based on today's date.
for example,
today is 19/12/2014,
and when it comes to tomorrow it will change automatically to 20/12/2015, and next.

It is one of the standard choices, if you choose column type "Date and time"- see the defaults section at the bottom.

You can add formula
=[Today]
if you have bad day thats mean you have messes up with servers time services but you can hitfix that:
=[Today] + 1
but it will only work after editing the item (I think), so programically solution is timerjob that run everyday and set last day dates to next date

Related

Amazon Quicksight Dynamic date filter

so everyday I receive sales data from the previous day. So today November 15 I have data from July 2021 until November 14 2021. What I want is to show this data for the current month by aggregating by day. I use a quicksight visual with a MTD (Month To Date) filter. Everything is fine so far.
The problem is on each first date of the month, I see "No Data" on my visual which is normal since I do not have any data from the current day/month but as I said earlier from the day before.
So what I want to achieve is:
Each 1st of current month: show data from the whole previous month
From 2nd to last day of current month: show data from the current month
Can someone help me please to know how I can achieve this?
I looked for ways to do this and I found dynamic default parameters but this option is not fine with me since I have to fill a username column according to the documentation (https://docs.aws.amazon.com/quicksight/latest/user/parameters-set-up.html) and I have many users so it will be not interesting to list all of them.
You can assign parameters to a group rather than a specific user which is much quicker
There is new functionality which allows you to set today or beginning/ending of month/quater/year as default.
See screenshot:
enter image description here

SharePoint Designer 2010 - Determine if today's date is within x days of a start date column using conditional formatting

I'm using SPD 2010 and Sharepoint Server 2010.
Using conditional formatting I'm trying to format a list so that if today's date is greater than 3 days past the start date column a cell will turn red.
Comparing two date columns directly (to see if today is after the start date) works well -
ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/#StartDate))) < ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today)))
But if I add a number it will work in SPD design view, but not on the actual SharePoint site.
ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/#StartDate))) + 3 < ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today)))
I tried converting 3 to ticks -> 8,640,000/day and using that value, but that didn't work either (and doesn't work in SPD design view).
I can get the formatting to work if I create a column with a calculated date of "StartDate+3" and then compare that directly, however, it doesn't work if the column is not visible and I would rather not create additional columns.
Any ideas?
Thanks for you help.
The following worked for me:
number(ddwrt:FormatDateTime(ddwrt:FormatDate(string($thisNode/#StartDate),1033,1),1033,'yyyyMMdd')+3) <= number(ddwrt:FormatDateTime(ddwrt:FormatDate(string($Today),1033,1),1033,'yyyyMMdd'))
I don't know why, but this didn't work for me. The second FormatDateTime parameter - 'yyyyMMdd' - kept throwing an error.
This finally worked:
number(translate(substring-before(#StartDate,'T'),'-',''))+3 <= number(translate(substring-before($Today,'T'),'-',''))

Sharepoint 2007 date time in a list

We are using a custom list on Sharepoint where we require users to enter data with a date and time field. We have been facing huge issues in data validity when generating reports due to this field. Following are the kinds of mistakes:
Selecting AM instead of PM or vice verse. Changing to 24 hrs format doesn't help much because then the users select (as an example) 02:00 instead of 14:00 for 02:00PM.
There are errors regarding formats of dates, hence some entries have dates from the future or the past.
As the reports are generated each week, the list needs to be populated by the end of the week. If the month has changed between the week, people forget to change the month in the calendar and the entries are of the last week of the current month instead of the last week of the previous month.
Are there ways to configure the list(Pref. without programming) so that:
A. Only working hours are available in the time related dropdown.
B. Dates from the future are not allowed( Or not available)
Any help would be appreciated.
As far as I know, you won't be able to satisfy these requirements with no custom code.
If you decide to go down the coding path, what you need to do is create a custom field type. Let me know of you need help on this.

SharePoint View to automatically show only the current month?

I need to create a view that will automatically change from month to month to show only the current month (i.e. if current month is July - show items posted in July). Currently I have a view set up, but I have to manually change the month each time it changes (it's set up based on the first day of the current month and the last day of current month).
Thanks
You can do this by turning the problem on its head.
First you need to add two calculated columns that will work out the start an the end of the month. (This example uses [Due Date] but you can use any date/time column)
"Start of Month" =DATE(YEAR([Due Date]), MONTH([Due Date]), 1)
"End of Month" =DATE(YEAR([Due Date]), MONTH([Due Date])+1,1)-1
Then you setup a filter in your view for
"Start of Month" is less than or equal to [Today]
AND
"End of Month" is greater than or equal to [Today]
How To Use Filters in SharePoint to show items in the current Calendar Month
Create a CC "NextMonth" that adds one month to your date
=DATE(YEAR(Modified),MONTH(Modified)+1,"1")
create a view "ThisMonth" with this filter
"NextMonth" is greater than [Today]
this will always return the current month. can also be allpied to Year, to return current year
Create a CC "NextYear" that adds one year to your date
=DATE(YEAR(Modified)+1,MONTH(Modified),"1")
create a view "ThisYear" with this filter
"NextYear" is greater than [Today]
Now the trick is to return a view for last Month. Let me know if you figure this out
EDIT: Please see Ryan's solution below, it's more comprehensive.
I believe there is no out of the box solution for that. One trick can be to write code in default view which would actually set the month for you or redirect to any other view. Something like
SPWeb web = SPContext.Current.Web;
string[] monthViewUrls = { "url1", "url2", ... };
string currentMonthUrl = monthViewUrls[DateTime.Now.Month-1];
Response.Redirect(currentMonthUrl );
Hope this helps.
Can you live with the calendar view? That shows current month by default. Maybe you can start with that and try to customize it in SPD - it might retain its current month behavior.
Start of Previous Month
=DATE(YEAR(Created),MONTH(Created)-1,"1")
End of Previous Month
=DATE(YEAR(Created),MONTH(Created),-1)

SharePoint column default values - add 10 working days

In SharePoint MOSS 2007, I have created a custom content type that I will be applying to a document library. One of the required fields is "Incoming Date" and another is the "Due Date".
The Due Date is always 10 working days from the Incoming Date. The Incoming Date is when the mail room received the letter, not necessarily when the document is posted to the library.
From here: http://msdn.microsoft.com/en-us/library/bb862071.aspx
=DATE(YEAR([Incoming Date]),MONTH([Incoming Date]),DAY([Incoming Date])+10)
adds 10 days, but how can I add 10 working days? I don't have the luxury of VS.NET either per the governance plan of our sharepoint rollout.
Assume a human is responsible for the data entry, but I would like to make it easier for them.
It's overkill for the very specific '10 days' requirement, but this should calculate a due date for any number of days from any start date.
I wrote it to match the result of Excel's WORKDAY function (which, given that every function in a calculated field is an Excel function, should almost be a thing). It's tested for 1 to 146 "days to complete", for each day of the week, and across years, without any sign of inconsistency. Unless I made a typo copying it from Excel, it should work as advertised. The only down side is that it doesnt do holidays, but if the users are accustomed to SharePoint they wont have expectations anyway. At all. Of any kind. For anything. Or hope. Or the muscles in their face that used to be responsible for smiling. Or the ability to look at a child and see anything but the bleak certainty of withering death. So, not a big deal if their task is due on Christmas. It's also sloppier than it probably needs to be.
=[Start Date]+[Days to Complete]
+ ROUNDDOWN([Days to Complete]/5,0)*2
+ IF(WEEKDAY([Start Date])+MOD([Days to Complete],5)>=7,2,0)
- ROUNDDOWN(WEEKDAY([Start Date])/7,0)
+ IF(AND(MOD([Days to Complete],5)=0,WEEKDAY([Start Date])=1),-2,0)
+ IF(AND(MOD([Days to Complete],5)=0,WEEKDAY([Start Date])=7),-2,0)
The first line is...obvious. The second line adds weekends. And the next 4 lines adjust for the deficiencies of the second line.
Firstly I should point out that you are making hard work of that formula, this will do the same.
=[Incoming Date] + 10
From the comments you have figured out that 10 working days (M-F) will always have 2 weekends so you can use this
=[Incoming Date] + 14
But this still doesn't take account of holidays
You are not going to be able to do this without some custom code in a workflow or possibly some javascript 'hack' and a database of holiday days for your region.
One possibility would be to default your Due Date to 10 working days from now when the record is created
=Today+14
and then rely on your users to manual alter this date if there are holidays in that period.
More details on this in a blog entry I've just written - Working Days, Weekends and Holidays in SharePoint Calculated Columns
Perhaps you can work around this limitation by using a workflow (possibly a custom one) to manage the due date? A due date implies that it is an actionable item that should be assigned to somebody anyways.
Note that VS.NET doesn't have to be a luxury - you can use it for free.
I believe I've figured out a fairly bullet-proof method for calculating a 10 business day deadline that accounts for holidays and weekends. 1) Calculate whether the 2 week period is a Monday, and if so, add only 11 days (assuming the start day counts as Day1 of your 10-day period). Otherwise, you add 13 to account for the 10 working days plus two weekends (remember, the start date already counts as Day1; your variables would be 12 and 14 if you did NOT count the start date as Day1). 2) Create a unique calculated column for every holiday and return a value of 1 if the holiday falls in the range. 3) Determine your "gross date" by adding values (weekends and holidays) to your start date. 4) Determine whether your gross date falls on a Saturday or Sunday, and if so, return the appropriate number of days to push off until Monday. 5) Add all the weekend, holiday, and added Sat and Sun values to your start date, which gives you your due date.
NOTE: The only challenges I see here is if a holiday pushes the due date into the weekend, which then pushes the due date to a Monday that happens to be yet another holiday. This didn't happen in my holiday schedule, but it might in yours. In addition, you'll need to keep adding new holidays every year, thus requiring you to recreate the column arrays from scratch for a long-running list. Alternatively, you could start a new list every year.
C_Wknd =IF(TEXT(WEEKDAY([Complaint Created On]),"ddd")="Mon",11,13)
C_NYDay =IF(AND([Complaint Created On]<=DATE(2009,1,1),([Complaint Created On])+C_Wknd>=DATE(2009,1,1)),"1","0")
C_MLKDay =IF(AND([Complaint Created On]<=DATE(2009,1,19),([Complaint Created On])+C_Wknd>=DATE(2009,1,19)),"1","0")
C_MemDay =IF(AND([Complaint Created On]<=DATE(2009,5,25),([Complaint Created On])+C_Wknd>=DATE(2009,5,25)),"1","0")
C_PresDay =IF(AND([Complaint Created On]<=DATE(2009,2,16),([Complaint Created On])+C_Wknd>=DATE(2009,2,16)),"1","0")
C_IndDay =IF(AND([Complaint Created On]<=DATE(2009,7,4),([Complaint Created On])+C_Wknd>=DATE(2009,7,4)),"1","0")
C_LabDay =IF(AND([Complaint Created On]<=DATE(2009,9,7),([Complaint Created On])+C_Wknd>=DATE(2009,9,7)),"1","0")
C_ColDay =IF(AND([Complaint Created On]<=DATE(2009,10,12),([Complaint Created On])+C_Wknd>=DATE(2009,10,12)),"1","0")
C_VetDay =IF(AND([Complaint Created On]<=DATE(2009,11,11),([Complaint Created On])+C_Wknd>=DATE(2009,11,11)),"1","0")
C_ThxDay =IF(AND([Complaint Created On]<=DATE(2009,11,26),([Complaint Created On])+C_Wknd>=DATE(2009,11,26)),"1","0")
C_XmsDay =IF(AND([Complaint Created On]<=DATE(2009,12,25),([Complaint Created On])+C_Wknd>=DATE(2009,12,25)),"1","0")
C_GrossDte =[Complaint Created On]+C_Wknd+C_NYDay+C_MLKDay+C_MemDay+C_PresDay+C_IndDay+C_LabDay+C_ColDay+C_VetDay+C_ThxDay+C_XmsDay
C_EndSat =IF(TEXT(WEEKDAY(C_GrossDte),"ddd")="Sat",2,0)
C_EndSun =IF(TEXT(WEEKDAY(C_GrossDte),"ddd")="Sun",1,0)
Resolution Due =C_GrossDte+C_EndSat+C_EndSun

Resources