Hướng dẫn format date php dd/mm/yyyy - định dạng ngày php dd / mm / yyyy
Tôi có thể thấy câu trả lời tuyệt vời, vì vậy không cần phải lặp lại ở đây, vì vậy tôi muốn đưa ra một số lời khuyên: Tôi khuyên bạn nên sử dụng số nguyên thời gian UNIX thay vì định dạng ngày có thể đọc được để xử lý thời gian trong nội bộ, sau đó sử dụng hàm
Sau đó, sử dụng
Bằng cách này, bạn sẽ tránh được nhiều vấn đề đau đầu với các định dạng ngày, chuyển đổi và múi giờ, vì ngày của bạn sẽ ở định dạng tiêu chuẩn hóa (thời gian unix) nhỏ gọn, độc lập với thời gian (luôn luôn ở UTC) và được hỗ trợ rộng rãi trong các ngôn ngữ và cơ sở dữ liệu lập trình .
Sử dụng chức năng ngày mặc định.
EDIT Tôi vừa thử nghiệm nó, và bằng cách nào đó, PHP không hoạt động tốt với định dạng dd / mm / yyyy. Đây là một giải pháp khác. Tôi vừa thử nghiệm nó, và bằng cách nào đó, PHP không hoạt động tốt với định dạng dd / mm / yyyy. Đây là một giải pháp khác.
209 hữu ích 5 bình luận chia sẻ 5 bình luận chia sẻ I have this MySQL query, which returns two dates (which are both formatted as a-m-Y). Now I want to translate this date into my own language (Danish). How can I do that. I have tried both the setlocale() and strftime() functions, but it won't work. I know it's a very basic question, but i really need help :) Thanks a lot! asked Aug 2, 2011 at 10:53Aug 2, 2011 at 10:53 Use 8 and 9 together:
Works on my php installation on Windows.
answered Aug 2, 2011 at 11:03Aug 2, 2011 at 11:03 5 I found that 8 isn't reliable, as it is set per process, not per thread (the manual mentions this). This means other running scripts can change the locale at any time. A solution is using IntlDateFormatter from the 1 php extension.
answered Jun 7, 2016 at 11:55Jun 7, 2016 at 11:55 Simon EpskampSimon EpskampSimon Epskamp 8,0463 gold badges52 silver badges56 bronze badges3 gold badges52 silver badges56 bronze badges 1 I don't think the Instead, I would recommend you take a look at the 61 class (quoting) : 61 class (quoting) :
There are a couple of examples on the manual page of 7, where that method is used to display a date in two different languages, by just setting the desired locale.
answered Aug 2, 2011 at 10:56Aug 2, 2011 at 10:56 Pascal MARTINPascal MARTINPascal MARTIN 388k77 gold badges646 silver badges656 bronze badges77 gold badges646 silver badges656 bronze badges 2 This Will Surely works for you if you want norwegian date and month format
if you want to get other language locale ids like nb_NO then refer this site International Components for Unicode (ICU) Data International Components for Unicode (ICU) Data answered Nov 4, 2020 at 13:38Nov 4, 2020 at 13:38 DhruvDhruvDhruv 1,7341 gold badge5 silver badges6 bronze badges1 gold badge5 silver badges6 bronze badges If you are trying to convert a 8 try this:
Pranav Singh 15.1k24 gold badges76 silver badges98 bronze badges24 gold badges76 silver badges98 bronze badges answered Jan 7, 2014 at 2:48Jan 7, 2014 at 2:48 |