Hi
After doing some searching on the forum and looking at the control panel options I can't see a way to change the date format to day / month / year, is this something that requires a code change or is there an admin option for it?
Cheers
How to change date formate dd/mm/yyyy
Re: How to change date formate dd/mm/yyyy
You have to change the code. But it will be a very simple change. You just need to call the ToString() function on the date object with some suitable parameter. For example in your case it could be
Code: Select all
theDate.ToString("d"); // result = "03/01/2007"
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 33
- Joined: Mon Oct 22, 2007 12:08 am
- Location: Australia
Re: How to change date formate dd/mm/yyyy
Unfortunately, I cannot see how your suggestion works in the following instance:
~/Admin/Orders/Print/Invoices.aspx
There is a line for Order Date:
<asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}") %>'></asp:Label>
How do we change the default US date format to Australian date format (dd/mm/yyyy) in the above instance?
~/Admin/Orders/Print/Invoices.aspx
There is a line for Order Date:
<asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}") %>'></asp:Label>
How do we change the default US date format to Australian date format (dd/mm/yyyy) in the above instance?
Re: How to change date formate dd/mm/yyyy
Try
Code: Select all
<asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}").ToString("d") %>'></asp:Label>
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 33
- Joined: Mon Oct 22, 2007 12:08 am
- Location: Australia
Re: How to change date formate dd/mm/yyyy
Thanks Mazhar for the code snippet. I tried it, but I get the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments
Source Error:
Line 190: <asp:Label ID="OrderNumber" runat="server" Text='<%# Eval("OrderNumber") %>'></asp:Label><br />
Line 191: <asp:Label ID="OrderDateLabel" runat="server" Text="Order Date:" SkinID="FieldHeader"></asp:Label>
Line 192: <asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}").ToString("d") %>'></asp:Label><br />
Line 193: </div>
Line 194: </td>
Source File: c:\inetpub\vhosts\boots-n-all.com.au\httpdocs\Admin\Orders\Print\Invoices.aspx Line: 192
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments
Source Error:
Line 190: <asp:Label ID="OrderNumber" runat="server" Text='<%# Eval("OrderNumber") %>'></asp:Label><br />
Line 191: <asp:Label ID="OrderDateLabel" runat="server" Text="Order Date:" SkinID="FieldHeader"></asp:Label>
Line 192: <asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}").ToString("d") %>'></asp:Label><br />
Line 193: </div>
Line 194: </td>
Source File: c:\inetpub\vhosts\boots-n-all.com.au\httpdocs\Admin\Orders\Print\Invoices.aspx Line: 192
Re: How to change date formate dd/mm/yyyy
In Order Manager update the Order Date Label as below
Code: Select all
<asp:Label ID="Label6" runat="server" Text='<%# Eval("OrderDate", "{0:dd/MM/yyyy}") %>'></asp:Label>