Viewing 11 replies - 1 through 11 (of 11 total)
  • You can format the Date & Time as you wish by editing the PHP to display in the format you like.:
    https://codex.www.ads-software.com/Formatting_Date_and_Time

    Displaying the results in Chinese pictograms is another matter, I suspect. More help on localising & translating dates is available about half way through this page:
    https://codex.www.ads-software.com/Translating_WordPress

    Understanding how to format Date & Time (first link) is key

    These approaches should work for all languages

    Nick Froome

    Thread Starter SerenaG

    (@serenag)

    Thank you Nick! ??

    The tricky bit for my project is displaying both the Chinese lunar dates next to Gregorian ones, both in the same calendar (I’m using the Events Caldendar plugin), so changing locale doesn’t help.
    And the Chinese lunar dates are not a translation of Gregorian dates, which means I need to add codes to calculate the lunar dates. Would appreciate if anyone can point me to a good place to add this function for this plugin… I’m having some difficulty pinpointing the exact location for my codes.

    Cheers!
    Serena

    OK, if Chinese lunar dates are not a direct translation of Gregorian dates then finding a way of displaying them via PHP formatting dates won’t help

    How about this: add a custom field of Chinese lunar date. Change the encoding of the SQL database for that field to be appropriate for Chinese characters. Then enter the Chinese dates directly into the custom field and simply display them next to the Gregorian date or as required

    Calculating them will be relatively simple (I smile even as I write that!) once you can determine the calculation that refers one to another. Outputting that calculation as Chinese characters via PHP may be a whole other thing. For that reason, and assuming you don’t have thousands of dates, I suggest you enter the dates by hand

    You could do this temporarily while researching a programmatic solution or permanently do it manually

    Nick Froome

    See also cdate.zip on this page:
    https://www.china-on-site.com/flexphpsite/downloads.html

    It seems I was born in the year of the dog so I may be barking up the wrong tree here

    Nick Froome

    Thanks a lot for the tips here, Nick, and for the added comedy bonus at the end there ??

    SerenaG: this give you what you need to move forward?

    Thread Starter SerenaG

    (@serenag)

    lol Nick! ??
    thanks for cdate, the algo looks good.

    roblagatta – hmmm not quite… ?? or i’m missing something here.

    “How about this: add a custom field of Chinese lunar date. Change the encoding of the SQL database for that field to be appropriate for Chinese characters. Then enter the Chinese dates directly into the custom field and simply display them next to the Gregorian date or as required”

    I wish for the date to appear next to the Gregorian date, in the header of each cell. Not to be entered via a custom field. Any idea where I can add codes to display them (which php file)? The dates should be auto-generated, just like the gregorian ones.

    Thread Starter SerenaG

    (@serenag)

    I have traced through the php codes for this plugin, but still cannot locate the part to customize monthly and daily headers… Would appreciate any help, cheers!

    Go right back to my first post about formatting Date & Time. That shows how to force PHP to display the date the way you want. The date is stored in SQL in one format and rendered by PHP in another and the PHP formatting tags determine how it is displayed

    An example taken from my events-list-load-widget-display.php file is

    <h4 class="event-day"><?php echo tribe_get_start_date( null, false,'jS F Y'); ?></h4>

    ( null, false,’jS F Y’) is the date formatting and a look at the PHP reference will let you decode it

    The rest of it will require quite a bit of work I expect. I can’t help feeling someone will have done it before but a Google search turns up lots of unhelpful results!

    Nick Froome

    Thanks for all your help on this, Nick!

    A few more notes for you:

    https://chinesenotes.com/chinese_text_dates.php

    Nick Froome

    You rock, Nick. Thanks again for your continued contributions ?? We’ll get you on our Happiness Engineer team yet!

    SerenaG: are you all set here? Can we mark this issue resolved? Let me know if you still have any concerns.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: The Events Calendar] Adding Lunar Dates to Calendar’ is closed to new replies.