Powershell dates to Sharepoint Dates - sharepoint

I have an old site that I am trying to convert to sharepoint. I have a database that stores the original upload date of the document. I need to get that date into a sharepoint column called "Original Upload". The "Original Upload" column is in a date/time format and only displays the date like "10/5/2009". I created a Powershell script to grab the date from the database and use it to change the "Original Upload" date in sharepoint. The problem is I keep getting a powershell error of "invalid date/time".
Powershell formats the date from the database as "Friday, May 06, 2011 7:52:12 AM". Sharepoint does not accept this date format. Sharepoint also does not accept strings. I was able to change the format of the powershell date to "5/6/2011" (the format on the sharepoint site), but it is converted from an object to a string, which doesn't work.
How do I convert a powershell date to "5/6/2011" and keep it as an object so Sharepoint will accept it?
Thanks

Sharepoint accepts iso date format which have format:
yyyy-MM-ddThh:mm:ssZ
in your example:
2011-05-06T07:52:12Z

Related

Date Field in SharePoint(On-Prem) list returns Previous day Date instead of current date in MS-Flow(Online)

Issue: We have created a MS Flow to trigger, when an item is created in SharePoint list (On-Prem) and in flow (On-Cloud) returns the date field value as One day before of actual date value.
eg: If I have a Due Date field in SharePoint List and created new items with a Due Date valueas 6/28/2019, but at the time of Flow trigger it returns the Due Date value as 6/27/2019.
And I have configured the Sharepoint App server(On-Prem), Database server(On-Prem), MS-Flow (Online) to IST time zone, but still I'm facing the issue.
Regards,
Tharma KS

How to edit external lists in sharepoint designer 2013

I currently have a simple external content type that displays a very small sql table on a external list in my SharePoint site. The problem is I have a date of birth field that gets formatted with the DateTime type instead of the Date type that is used when I created the SQL table. The biggest issue I am facing is the lack of designer view in SharePoint Designer 2013 that was included in 2010. Since I am forced to work with the source code, how do I go about formatting the date of birth fields so that it is displayed in simple Date format example: 01/01/2001. And also prevent the time from showing when adding or entering a new record to the list.
You could use a SELECT LEFTSQL statement to pull just the relevant information. Are you familiar with this method?
For clarification, here's an example:
CDate(Left([FieldName],10)
While being sure to change [FieldName] to match the field's name in your table.

Changing date format in display templates for SharePoint 2013

I have a Content Search Webpart that uses a customized Display Template to display results of recent changed documents.
I would like to show the "last modified-date" below the document Title.
I can then use #= ctx.CurrentItem.ModifiedOWSDATE =# to get the date, however the returned date is displayed as 2013-05-16T12:54:10Z.
How can I format the date so it is displayed like 16.05.2013 - 12:54 ?
iirc SharePoint should handle the date conversion if you use the same approach as you do with new Property Mappings.
Copy/paste a variable in the template, something like:
var modifiedDate = $getItemValue(ctx, "ModifiedOWSDATE");
modifiedDate.overrideValueRenderer($contentLineText);
And use that variable instead:
<p>_#= modifiedDate =#_</p>
If creating a new custom Value Renderer etc is not an option for formatting the date (The default pattern used by Search.ClientControls isLongDatePattern I think). One could always create a Date variable, and do as fit:
Example:
<p>_#= new Date(modifiedDate["inputValue"]).toLocaleString() =#_</p>

Change SharePoint default date time format to dd MMM yyyy

How do we change SharePoint default date time format to dd MMM yyyy( e.g., 1 May 2013),
We can change regional setting to change date format but i can not find anything which display month as word.
I am referring following article it seems working except dd MMM yyyy format ( e.g., 1 May 2013). I've notice issue with displaying month in word, other format seem working.
http://sharepointex.blogspot.in/2007/09/how-to-modify-date-format-in-sharepoint.html
Any idea why it month name is not displaying as expected?
Regards,
For Sharepoing 2010 Regional Settings are hidden for the Central Admin site collection. However, you can get to them by typing the url (substitute mysharepointserver:port for your central admin web application).
http://mysharepointserver:port/_layouts/regionalsetng.aspx
I understand that you want to change the format of date& time columns for a SharePoint Site .Here are two options :
1.You can modify the view of the view in SharePoint Designer to format the date &time column . Change the formula to ddwrt:FormatDate(string($thisNode/#*[name()=current()/#Name]),1033,7) .
2.You can Modify the Regional Settings for the site collection .Change the Locale to other countries ,the date format will change automatically for all the existing data &time columns .
I have tried with German and its date &time format is like dd mm yyyy .
Just change the Locale from Site's Regional Settings within Site Administration > Regional settings.
I have tried with SharePoint 2013
Thanks,
Chiranthaka
I understand you need a global site setting; however if you opt for the field by field format, you can format to a specific format by specifying "dd MMM yyyy" explicitly in your XSL.
<xsl:value-of select="ddwrt:FormatDateTime(string($thisNode/#*[name()=current()/#Name]) ,1033 ,'dd MMM yyyy')"/>
http://afsawaf.blogspot.com/2013/12/sharepoint-2010-format-view-date-format.html
Good luck!

SharePoint Designer 2007 : Remove seconds fields from the email

The email notification sent out by the SharePoint Designer 2007 workflows includes seconds for the date/time field.
For example "This is a confirmation that you are registered to attend a DEMO at 10:00:00 AM".
How can I remove the seconds field from the email message.
The SharePoint List with date/time field displays fine (without the seconds)
Thanks
One option - you could create a calculated column to show a formatted version of your date and include that column in your email.
For example if you've got a field called "My Date" then you can create a calculated column called "My Formatted Date" (or whatever makes sense) using the following formula.
=TEXT([My Date]","mmm yyyy")
will display the date in a format like Jul 2011
=TEXT([My Date]","dd/mm/yyyy")
Will show 21/7/2011.

Resources