I'm betting this is so simple that i'm overlooking things. Currently my dates are being stored as:
"2008/11/08 12:00:00 AM"
The format i'm wanting it to be displayed as should be:
"08 November 2008 12:00:00 AM" or "08/11/2008 12:00:00 AM"
The time whether displayed or not is not that important at the moment.
Thanks,
2 Answers, 1 is accepted
Test the following:
<telerik:GridDateTimeColumn DataField="ShippedDate" DataType="System.DateTime" DataFormatString="{0:dd MMMM yyyy hh:mm tt}" |
HeaderText="ShippedDate" SortExpression="ShippedDate" UniqueName="ShippedDate"> |
</telerik:GridDateTimeColumn> |
Let me know if you need more information.
Kind regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use regular telerik:GridBoundColumn but then you have to add "DataType="System.DateTime" too as following:
<telerik:GridBoundColumn DataField="DateAdded" DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime" HeaderText="Date Added" ></telerik:GridBoundColumn>
I used Above solutions and it works fine but when I want to assign that data to a raddatepicker , It only works if I use "DataFormatString="{0:MM/dd/yyyy}" .
when I'm using below format:
<telerik:GridBoundColumn DataField="Order_Date" FilterControlAltText="Filter Order_Date column" HeaderText="Order Date"
UniqueName="Order_Date" EmptyDataText=""
DataFormatString="{0:dd/MM/yyyy}" DataType="System.String">
which is English format, I receive error that "System.FormatException: String was not recognized as a valid DateTime."
DateTime orderdate1 =Convert.ToDateTime(SelectedItem["Order_Date"].Text);// receive error for this line
DatOrderDate.SelectedDate = orderdate1; //Datorderdate is a raddatepicker
It means that the value you are trying to parse (SelectedItem["Order_Date"].Text) is not a valid DateTime representation. Please make sure that the value returned can be successfully parsed to DateTime object:
https://msdn.microsoft.com/en-us/library/system.datetime.parse%28v=vs.110%29.aspx
https://msdn.microsoft.com/en-us/library/ch92fbc1%28v=vs.110%29.aspx
Generally, if you will create a column for a DateTime field, you can use a GridDateTimeColumn with DataType="System.DateTime" and add your desired DataFormatString.
Regards,
Eyup
Telerik
Hello. I am looking for this format (4/25/2018 12:00 AM/PM) dd/mm/yyyy hh:mm AM/PM)
I tried the solution which you have provided but didnot work for me.
tried with the below formats .Instead of AM or PM in export to excel its displaying as tt. I have also mentioned .Please help me soon
DataType="System.DateTime"
DataFormatString="{0:dd MMMM yyyy hh:mm tt}"
DataFormatString="{0:MM/dd/yyyy hh:mm tt}"
Is there a way to easily handle displaying date-time columns according to when PDT (Pacific Daylight Saving Time) and PST (Pacific Standard Time) is being observed?
Thank you in advance
Generally, you can set the DateFormatString property of the column to set a specific formatting similar to the attached web site sample.
You can modify this property manually depending on your Culture and selected DateTime mode, however, this will probably require a RadGrid1.Rebind() call to refresh the grid content.
Instead, on PreRender event handler of the grid you can traverse its Items collection and set the text manually to the cells using code-behind formatting pattern either with C# or VB.
Regards,
Eyup
Progress Telerik
In my
For Each item As GridDataItem In grdPosizioniFisse.Items
....
how can I set the PubDate with day name before?
For example, If I have 08/07/2020 in the header (I have date fields in columes header),
I should get Mer 08/07/2020 (in Italian language).
Thanks a lot.
Luis
Hello Luis,
I've already replied to your query in the following thread:
https://www.telerik.com/forums/format-date-with-day-name-in-headers
I suggest that we continue our technical conversation there.
Regards,
Eyup
Progress Telerik