Eduardo Fuerte
asked on
Could you point how to format a date from YYYY/MM/DD HH:MM:SS to DD/MM/YYYY HH:MM:SS by using jQuery?
Hi Experts
Could you point how to format a date from YYYY/MM/DD HH:MM:SS to DD/MM/YYYY HH:MM:SS by using jQuery?
Thanks in advance.
Could you point how to format a date from YYYY/MM/DD HH:MM:SS to DD/MM/YYYY HH:MM:SS by using jQuery?
Thanks in advance.
ASKER
Really
The better strategy is to change it obtaining also formated from DB in the desired format.
The better strategy is to change it obtaining also formated from DB in the desired format.
Eduardo, please, please, please take a moment to learn the right way of handling date/time values. This is not "new" or something that needs to be reinvented. We have the ISO-8601 standard for date/time representations. All internal computer programming date/time representations should be ISO-8601. You only change the format for external display, full stop. It's really, really, really worth doing it the right way because any other way leads to endless troubles, sadness, confusion, tears, and anguish. Even little things, like the difference between slashes and dashes, can matter a lot, but there are safe, predictable ways to handle these values. I promise that the "good ways" are your friend!
Here's the ten-year old procedural way:
https://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL-Procedural-Version.html
Here's the modern object-oriented way:
https://www.experts-exchange.com/articles/20920/Handling-Time-and-Date-in-PHP-and-MySQL-OOP-Version.html
Here's the ten-year old procedural way:
https://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL-Procedural-Version.html
Here's the modern object-oriented way:
https://www.experts-exchange.com/articles/20920/Handling-Time-and-Date-in-PHP-and-MySQL-OOP-Version.html
ASKER
@Ray
Thank you for your concerns.
I guess this case is a matter of jQuery date convertion. I don't see how to capture the textbox value by PHP code.
Thank you for your concerns.
I guess this case is a matter of jQuery date convertion. I don't see how to capture the textbox value by PHP code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, I misunderstood this to be a PHP question because it was in the PHP topic area. The JS Date() method looks like the right solution.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for help!
You are welcome.
Open in new window
But if you do you will get this warning noticeBottom line you need to look at why you need those formats and potentially change them.