WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Last.fm For Artists] Change the way the date is displayed. (3 posts)

  1. AFox
    Member
    Posted 5 years ago #

    I cannot seem to find a way to change the format for the date. I edited the php file... but it still shows it the "euro" way.

    How do I make it say:

    Sunday, June 28 2009 at 1:08 PM
    instead of
    28.06.09 13:08

  2. j.org
    Member
    Posted 5 years ago #

    Hi AFox,

    yes - changing the format of date (and time) isn't very convenient at this time, because it's part of the translation files. The main reason for this decision was that date is automatically formatted according to your chosen language.

    However I am aware of this problem and up to now I didn't have a good idea on how to allow for date format changes. Any suggestion is a good suggestion here.

    Attention: the line numbers are valid only for version 0.7

    But for a quick fix it should suffice to make the following changes. You can read about possible date format strings here.

    • For tag %STARTDATE%: Change line 963, replace
      __( '%d.%m.%y', LFM_US_DOMAIN) (which is a format which gets localized) with a string of your choice.
      E.g. '%A, %B %e %Y'
    • For tag %ENDDATE%: Change the same on line 964.
    • Tag %STARTTIME%: You'll find it on line 965, again replace the whole
      __( '%H:%M', LFM_US_DOMAIN) with your own format, e.g. '%l:%M %P'.
    • For tag %DATE%: Here it begins to get complicated because this specific tag respects single and multi-day events, with and without a start time. The corresponding format strings (same pattern as above) can be found on line 943, 944, 947 and 950.

    So... as you can see this isn't very difficult to change in principle, but providing a generic way to choose a arbitrary format isn't that trivial.

    Another and way more enduring option would be to create a distinct translation file for English and use a satisfying format there. In that way you could support other users having the same problem.

    Best regards,
    j.org.

  3. j.org
    Member
    Posted 5 years ago #

    Hi AFox,

    yes - changing the format of date (and time) isn't very convenient at this time, because it's part of the translation files. The main reason for this decision was that date is automatically formatted according to your chosen language.

    However I am aware of this problem and up to now I didn't have a good idea on how to allow for date format changes. Any suggestion is a good suggestion here.

    Attention: the line numbers are valid only for version 0.7

    But for a quick fix it should suffice to make the following changes. You can read about possible date format strings here.

    • For tag %STARTDATE%: Change line 963, replace
      __( '%d.%m.%y', LFM_US_DOMAIN) (which is a format which gets localized) with a string of your choice. E.g. '%A, %B %e %Y'
    • For tag %ENDDATE%: Change the same on line 964.
    • Tag %STARTTIME%: You'll find it on line 965, again replace the whole
      __( '%H:%M', LFM_US_DOMAIN) with your own format, e.g. '%l:%M %P'.
    • For tag %DATE%: Here it begins to get complicated because this specific tag respects single and multi-day events, with and without a start time. The corresponding format strings (same pattern as above) can be found on line 943, 944, 947 and 950.

    So... as you can see this isn't very difficult to change in principle, but providing a generic way to choose a arbitrary format isn't that trivial.

    Another and way more enduring option would be to create a distinct translation file for English and use a satisfying format there. In that way you could support other users having the same problem.

    Best regards,
    j.org.

Topic Closed

This topic has been closed to new replies.

About this Topic