Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get date in right format!!

Status
Not open for further replies.

net123

Programmer
Oct 18, 2002
167
US
I am getting my date in the following format: dd/mm/yyyy, but would like in this format: mm/dd/yyyy.

I have 2 pages: form.aspx and popup.aspx.

On the form.aspx I have the following snippet where the textbox is located:

<asp:Label id=&quot;Label7&quot; runat=&quot;server&quot;>Date</asp:Label>
&nbsp;<asp:TextBox id=&quot;txtDate&quot; runat=&quot;server&quot;>
</asp:TextBox>

<A href=&quot;javascript:GetDate('txtDate')&quot;><IMG style=&quot;WIDTH: 18px; HEIGHT: 16px&quot; height=&quot;16&quot; alt=&quot;PopUp Calendar&quot; src=&quot;calendar.gif&quot; width=&quot;18&quot; border=&quot;0&quot;></A>
[/blue]

And at the top (head) of this page, there is some javascript:

<script language=&quot;Javascript&quot;>

function GetDate(CtrlName)
{

ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, &quot;PopUpCalendar&quot;, &quot;width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no&quot;);
}

function CheckWindow()
{
ChildWindow.close();
}

</script>

[/blue]

My calendar.aspx file has the following:


<HTML>
<HEAD>

<script language=&quot;Javascript&quot;>
function ReturnDate()
{

window.opener.document.forms[&quot;<%= strFormName %>&quot;].elements[&quot;<%= strCtrlName %>&quot;].value = &quot;<%= strSelectedDate %>&quot;;
window.close();

}

function Close()

{
window.close();
}
</script>
</HEAD>
<body>
<form runat=&quot;server&quot; ID=&quot;Form1&quot;>
<table>

<tr>
<td align=&quot;middle&quot;>
<asp:Calendar id=&quot;myCalendar&quot; runat=&quot;server&quot; BorderWidth=&quot;1px&quot; BackColor=&quot;White&quot; Width=&quot;220px&quot; DayNameFormat=&quot;FirstLetter&quot; ForeColor=&quot;#003399&quot; Height=&quot;200px&quot; Font-Size=&quot;8pt&quot; Font-Names=&quot;Verdana&quot; BorderColor=&quot;#3366CC&quot; OnSelectionChanged=&quot;myCalendar_SelectionChanged&quot; CellPadding=&quot;1&quot; BorderStyle=&quot;Double&quot;>
</asp:Calendar>
</td>
</tr>
<tr>
<td align=&quot;middle&quot;>
<input id=&quot;btnReturnDate&quot; onclick=&quot;Javascript:ReturnDate()&quot; type=&quot;button&quot; value=&quot;Select&quot; runat=&quot;Server&quot; NAME=&quot;btnReturnDate&quot;>&nbsp;
<input id=&quot;btnCloseWindow&quot; onclick=&quot;Javascript:Close()&quot; type=&quot;button&quot; value=&quot;Close&quot; runat=&quot;Server&quot; NAME=&quot;btnCloseWindow&quot;>
</td>
</tr>
</table>
</form>
</body>
</HTML>

[/red]

I can't seem to figure where is the formatting of the date!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top