laravel-timezone icon indicating copy to clipboard operation
laravel-timezone copied to clipboard

Formatting dates

Open quevlu opened this issue 3 years ago • 7 comments

Hello, is it possible to get the format date for each country ? I'm not sure if the APIs return information connected to date format each country.

quevlu avatar Feb 15 '22 02:02 quevlu

Interesting question. I'd have to spend some time on google.

jamesmills avatar Feb 15 '22 02:02 jamesmills

@jamesmills Hi, I've found a php class to handle different format dates:

https://www.php.net/manual/en/class.intldateformatter.php

quevlu avatar Mar 05 '22 20:03 quevlu

I'll work on it and submit a Pr. Let me work on it

quevlu avatar Mar 05 '22 20:03 quevlu

https://stackoverflow.com/questions/44387956/php-get-current-locale-using-timezone

I could very well be an English speaking American visiting Japan, thus my time zone would be Asia/Tokyo even though my local would still be en-US.

quevlu avatar Mar 06 '22 21:03 quevlu

Valid point, but it would be great as a default. A member signs up and it detects timezone and date/format and you can change both from there. This would be a great feature!

seabasss avatar Mar 06 '22 21:03 seabasss

I was thinking if you get the language from the user it would be a possibility to do it

quevlu avatar Mar 06 '22 22:03 quevlu

https://www.w3.org/International/questions/qa-date-format.en#:~:text=Opci%C3%B3n%20uno%3A%20usar%20un%20formato,%2C%202003%2Dabr%2D02.

I've been using this format "Y/M/d g:i a" and the result is 2022/Mar/06 7:10 pm

quevlu avatar Mar 06 '22 22:03 quevlu