.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

SPGridView date formatting

Posted By:      Posted Date: October 26, 2010    Points: 0   Category :SharePoint


I am using SPGridView in SP2010. I am attaching a datatable to this SPGridView which has a date column in it. But, I dont want to show the timestamp which is comming alongwith the date.

There is no dataFormatString property supported for the SPGridView. How do I achieve the same..?

Thanks in advance..


View Complete Post

More Related Resource Links

Date formatting in SPGridview


How can I format the date from 9/23/2010 12:00:00 AM to 9/23/2010 in an SPGridview?

Thanks, Ninel

date formatting


I have a 3 field table in sql server express and one of the columns is a date.

I'm trying to pull that in and publish to a gridview, but when I do it comes in with the date and minutes and seconds, etc.

How can I format that so that I only publish MM/DD/YYYY?

thanks in advance 

Formatting the date with the CalendarExtender

I must be missing something here.  I use the code below to display a DateTime value, and the time is always displaying, i.e. 7/11/2010 08:10:10. I just want the date.  The Format value doesn't seem to have any effect.    <asp:TemplateField HeaderText="Exp Date" HeaderStyle-Width="100px">   <ItemTemplate>   <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("expirationDate") %>'></asp:TextBox>   <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="MM/dd/yy" />   </ItemTemplate>   </asp:TemplateField>

Date Validation and Date Formatting

 Hi,   I am new to ASP.NET 4.0 and the whole Object Oriented Programming.  I added a Calendar Extender on a text box.  Now I would like it to be formatted to MM/DD/YY, PLUS, I also want to validate if the date entered is more than let's say 90 days from today.  If it is more than 90 days, I would like to show something like an error message and set the focus on the date field.  I am writting my code in C#.  Can any body help on this?  Thank you. esant    

Date Time Formatting to a specific dateformat

Hello All,I have been struggling with this for a long time. I have a form in which there is a textbox using an ajax calender extender. Now, the problem is that, I want to take the Date value which is string format and format it to a specific date format before inserting it into the database. The following is the core problem:Dim MDate as string=txtMeetingDate.Textdim d as new Datetime' I want to convert the d to a datetime using the Mdate/// The problem is that I don't know what's the date format in the TextBox because users can use any time format they want, it is based on their windows settings!!!So, I am struggling to change my String (MDate) into a DateTime in the same format the user have and then convert it into my format:"dd/MM/yyyy" and after I have the date in the correct format, I want to change it back to string and save it in the database.I am doing this so that I have the same dateformat saved in my database.Any Ideas? ThanksAMB

Formatting Date consisting of several Fields but no value for the day



     I´m working on some reports with SSRS 2008 and I need to display a date in the format dd.mm.yyyy. Normally that would be easy but the Problem is, that the Date I need to display doesn´t exist as a Field. I have a Field containing the month and another Field containing the year but no field containing the day. Furthermore the day should be always the last day of the month. Does anybody know how to solve this date-puzzle?


Your help would be much appreciated.


XPath Date Formatting Problem


Hey all, just plain and simple I think....lol

Why will this not work?

<asp:Label ID='playDate' runat='server' Text='<%# XPath("LastPlayed", "{0:MMM d yyyy}") %>'></asp:Label>

It completely ignors my date formating and returns this result.


Oh yea, this is in a datalist using an XML datasource.

Date formatting problem with BIDS


I've just moved to a new PC, and had BIDS installed on it.  All machine dates are set to the international standard (dd/MM/yyyy).

I just opened an existing report to modify it that includes a date range in the parameters.  When I tried to do a test preview of the report in BIDS, I got an invalid data error on the first date parameter.  After a bit of fiddling around, I worked out that it would only let me input the dates in US format, yet after input the dates are converted to international format.  When deployed to the report server, the report requires the dates to be input in international format.

I've spent half an hour checking my machine and BIDS to try and find the cause of this problem, and I'm stumped.

Any suggestions?

listview date formatting


i have a listview thats tied to an access database. and at the moment it displays the date like this:

27/10/2010 12:00AM

but i want it to display in long date format like this:

wednesday, 27, october, 2010

how would i achieve this?

thanks for your help in advance!! :)

simple answers with code sample would be appreciated...im only new at this


Date and Time String Formatting With C#.NET

System.DateTime newDate = System.DateTime.Now;
Console.WriteLine("date: {0}", newDate);// Current Date Time will be display

Dates and Times in C# .NET

SSRS 2008 - Passing parameter into textbox - can't seem to apply formatting to it (date/currency)


I have a report that is displaying a parameter in a textbox inside the report.

Now I right clicked on the textbox, went to properties, and set number formatting to: Date - 01/31/2000

However, when I render the report it does not display the date in that format. It displays it in the way the sproc returns it which is: 5/13/2011 3:08:30 PM

I tried changing the parameter type to TEXT instead of datetime, made no difference.

I am having the same problem with currency. I will return 12345 and it will just display that way in the textbox instead of $12,345.00.

Any suggestions?

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

jQuery Date picker Implementation in ASP.NET

I've posted a wrapper ASP.NET around the jQuery.UI Datepickercontrol. This small client side calendar control is compact, looks nice and is very easy to use and I've added it some time back to my control library.

This is primarily an update for the jQuery.ui version, and so I spend a few hours or so cleaning it up which wasn't as easy as it could have been since the API has changed quite drastically from Marc's original implementation. The biggest changes have to do with the theming integration and the resulting explosion of related resources.

If you want to use this component you can check it out a sample and the code here:

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend