Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7428339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:43:51+00:00 2026-05-29T08:43:51+00:00

In my model I have: [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = {0:dd/MM/yyyy})] public DateTime StartDate

  • 0

In my model I have:

    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
    public DateTime StartDate { get; set; }

Unfortunately, It only applies to EditorFor, but I cant assign the EditorFor a class, to enable Jquery Datetime picker, as there is no htmlAttributes parameter.

@Html.EditorFor(model => model.StartDate)
@Html.TextBoxFor(model => model.StartDate, new { @class = "datePicker", @readonly = "readonly" })

So the first shows only the date, but has no datepicker.
The second shows the time too 00:00 but has a datetimepicker.

Note: Dont just say, use model.StartDate.ToString("mm/DD/yyyy"). It does not work.

How Can I set just the Date. But have a timepicker for it And have readonly, so I cant type any numbers in it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:43:51+00:00Added an answer on May 29, 2026 at 8:43 am

    I’m using the jquery UI datepicker, which rather than append a class tag, I set the default date format via:

        $(function () {
            $.datepicker.setDefaults({
                dateFormat: 'dd/mm/yy'
            });
        });
    

    Then to bind it to the input element:

        $(function () {
            $("#StartDate").datepicker();
        });
    

    Hope that helps. And thats on the EditorFor mvc tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got my display format setup as so <DisplayName(birthdate)> _ <DisplayFormat(ApplyFormatInEditMode:=True, DataFormatString:={0:MM/dd/yyyy})> _ Public
I have a ViewModel with a property as below: [DisplayName(As Configured On:)] [DisplayFormat(DataFormatString={0:d}, ApplyFormatInEditMode=true)]
I have following dataannotation in my model class: [Required(ErrorMessage = Required)] [DisplayFormat(ApplyFormatInEditMode = true,
If I have Model.objects.all() I want to get only one object for any content_object=foo,
Using EF-generated classes, here's my metadata class: [DisplayName(Approved Date)] [DataType(DataType.DateTime)] [DisplayFormat(ApplyFormatInEditMode = true, HtmlEncode
Lets say I have model inheritance set up in the way defined below. class
I have a DateTime property on one of my Model classes and want to
If I have in my model class a property of type DateTime how can
I have a model with a DateTime property that in one place is placed
I have a DateTime field in my Model. If I try to use this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.