I want to format a string before assigning it to a label’s text property in jquery. I want something as follows (code is in C#),
string.Format("{0:MM/dd/yyyy}", m.hire_dt);
I am trying to format a date and other strings too. How could i achieve that?
If you are trying to format a date string, you can try the answer to this question. It’s basically suggests that you need to concatenate the different date components.
If you are using jquery UI and you need the built-in datetime picker, there’s a
formatDatefunction wherein you can specify which format you prefer.For general date manipulation, it is best to use Date.js.