0

hi
iam using calender along with javascript in asp.net.
here the problen is iam getting in mm/dd/yyyy format ,,,,,but i wants dd/mm/yyyy format so please give me the code,

here my code of calender (datepicker) as below

Imports System.Text


Namespace VbNetTest


    Partial Class DatePicker
        Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        End Sub


        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
        End Sub

#End Region

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Nothing to do, here
        End Sub

        Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
            '// Clear the link from this day
            e.Cell.Controls.Clear()

            '// Add the custom link
            Dim Link As System.Web.UI.HtmlControls.HtmlGenericControl
            Link = New System.Web.UI.HtmlControls.HtmlGenericControl
            Link.TagName = "a"
            Link.InnerText = e.Day.DayNumberText
            Link.Attributes.Add("href", String.Format("JavaScript:window.opener.document.{0}.value = '{1:d}'; window.close();", Request.QueryString("field"), e.Day.Date))

            '// By default, this will highlight today's date.
            If e.Day.IsSelected Then
                Link.Attributes.Add("style", Me.Calendar1.SelectedDayStyle.ToString())
            End If


            '// Now add our custom link to the page
            e.Cell.Controls.Add(Link)

        End Sub


        Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged

        End Sub
    End Class

End Namespace

here iam using vb.net.......
pls give me the answer...........

Edited by Ezzaral: Added code tags. Please use them to format all code that you post.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by mshravs
0

Perhaps if you change this e.Day.Date into this e.Day.Date.ToString("dd/MM/yyyy")
Otherwise you may have to complicate things by going into localization, but then your in the hands of the visitor and their local computersettings.

Edited by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.