Date format

Posted on 2005-05-14
Last Modified: 2010-04-07

I am using a DataPicker(calendar control) in my form. How can I populate the a textbox with selected date in DD MMM YYYY ?

Now I get the date in dd mm yyyy format. I have declared Culture="en-GB" in the page directive.

Question by:ayha1999
    LVL 23

    Accepted Solution

    TextBox1.Text = Calendar1.SelectedDate.ToString("dd MMM yyyy")
    LVL 7

    Author Comment

    Hi b1xml2,

    Where I do that in the code?

    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

            '// 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.ToString))

            '// 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

        End Sub

    and here is

    <a href="JavaScript:;" onclick="calendarPicker('Form1.txtDate,this);" title="Date">

    LVL 23

    Expert Comment

    you have server -side code
    you have client-code that cannot successfully call a server function!!

    it wont work. You misunderstand how ASP.NET works.
    LVL 23

    Expert Comment

    either that or I dont have enough info to carry on
    LVL 7

    Author Comment


    As I mentioned I can get the date in the textbox in dd/MM/yyyy format. How can I make dd MMM yyyy?

    sorry, I don't under understand your comment. No way to make it in dd MMM yyyy?


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now