SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DateTime/DateTimeZone - Format a timestamp using locale?

    So I discovered the wonders of DateTime and DateTimeZone but must have overlooked one critical problem - I cannot see how to use the current locale to format a timestamp!

    For example, today I would like to say its "Mars" (french), not "March".

    How can I do that with these classes?
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know PHP's DateTime object only supports English.

  3. #3
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by unwrittenphp View Post
    As far as I know PHP's DateTime object only supports English.
    It's unfortunate that it feels like a lot of these new objects we have are taking a step backwards (or at least, not forwards) in many aspects
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are in windows then there are different strings for setting setlocale. Like following does works:
    PHP Code:
    setlocale(LC_ALL'french');
    echo 
    strftime("%A %B"); // prints mardi mars 
    You will find windows setlocale strings as follows:
    http://msdn.microsoft.com/en-us/libr...zf(VS.71).aspx
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •