Locale Date Formatting on Client

Hi all,

in case the date is updated on the client, I need to handle and display the date by JavaScript within the browser. Using PHP or Yii functions like formatDateTime() don’t help here, because they generate static HTML code, in my case the time changes due to updates.

The locale is selected within Yii, but how to reformat the date/time on client side based on this Yii locale?

The JavaScript function toLocaleString() formats based on the browsers or operating-system locale, which is not what is selected in Yii, so it don’t help… :frowning:

Thanks a lot


Generate html and javascript code by php!

Oh yes, but how???

I’m able to get the locale definition as string (like “de_de”) by Yii/PHP, but how to input this to a format function on client with JavaScript?

Also getting the locale dependent format as string (like "dd.mm.yyyy") by Yii/PHP is possible, but how to format a date/time with this string on client with JavaScript?

(so I guess it’s more a JavaScript question as PHP, but in sum there is maybe another solution)



bump - nobody an idea???