rizwansyed Posted October 13, 2018 Share Posted October 13, 2018 Hi I need to get the time picker and display in format of DD/MM/YYYY. I checked below example it is showing on YYYY-MM-DD format https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_input_date_get How can i change it Thanks and Regards Rizwan Syed Link to comment Share on other sites More sharing options...
Funce Posted October 16, 2018 Share Posted October 16, 2018 Perhaps this has more information for you: https://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format The field that's shown is locale specific to browser. The date picker I see(Chrome) inputs as DD/MM/YYYY as that's how dates are written in New Zealand. If you're referring to the output of the date input, then you'll need to look into string manipulation. Anything with locale based input should always output in a standard fashion. This allows any program using the output to function in any locale. Link to comment Share on other sites More sharing options...
JMRKER Posted October 16, 2018 Share Posted October 16, 2018 On 10/13/2018 at 3:09 AM, rizwansyed said: Hi I need to get the time picker and display in format of DD/MM/YYYY. I checked below example it is showing on YYYY-MM-DD format https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_input_date_get How can i change it Thanks and Regards Rizwan Syed You can change the function called as a quick and dirty solution. function myFunction() { var x = document.getElementById("myDate").value.split('-'); document.getElementById("demo").innerHTML = x[1]+'/'+x[2]+'/'+x[0]; } Link to comment Share on other sites More sharing options...
rizwansyed Posted October 18, 2018 Author Share Posted October 18, 2018 Hi I need to manually select 12 and 24 hr time format How to get a 12 hr and 24 hr time picker .? Is there any code or link available Link to comment Share on other sites More sharing options...
Funce Posted October 18, 2018 Share Posted October 18, 2018 Have you seen: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time <input type="time" min="9:00" max="18:00" /> This one works on 24hr time. Link to comment Share on other sites More sharing options...
JMRKER Posted October 19, 2018 Share Posted October 19, 2018 22 hours ago, rizwansyed said: Hi I need to manually select 12 and 24 hr time format How to get a 12 hr and 24 hr time picker .? Is there any code or link available Is this a change from your original request? Is the time expected to be the time of the date selection? If not, where is the time selection supposed to be collected from? What kind of time intervals - 0 to 23 hours? - any minutes/seconds required? Difficult for me to envision solution with current information provided. Sorry Link to comment Share on other sites More sharing options...
Funce Posted October 22, 2018 Share Posted October 22, 2018 Here's one which may have some alternatives for you to explore: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local This one however doesn't run on Firefox, Opera and IE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now