DEV Community

SEO - NT Tech Innovation
SEO - NT Tech Innovation

Posted on AI-assisted

Scheduling Social Posts for Philippine Time (UTC+8) with Python and Cron

If your audience is in the Philippines but your server runs in UTC, every "post at 8 pm" job is a small timezone bug waiting to happen. Here is the simple setup I use for Philippine Standard Time.

PHT is easy, which is why people get it wrong

Philippine Standard Time is UTC+8 all year. No daylight saving. That sounds simple, so people hard-code +8 and then forget it when the server moves or a teammate in another country edits the cron line.

  • Use the IANA name Asia/Manila, not a raw offset.
  • Store every timestamp in UTC.
  • Convert to Manila time only for display and scheduling rules.

Python: picking the next posting slot

from datetime import datetime, time, timedelta
from zoneinfo import ZoneInfo

MNL = ZoneInfo("Asia/Manila")
SLOTS = [time(12, 0), time(19, 30), time(21, 0)]  # lunch, after work, late evening

def next_slot(now_utc: datetime) -> datetime:
    local = now_utc.astimezone(MNL)
    for day in range(0, 2):
        d = (local + timedelta(days=day)).date()
        for s in SLOTS:
            cand = datetime.combine(d, s, tzinfo=MNL)
            if cand > local:
                return cand.astimezone(ZoneInfo("UTC"))
    raise RuntimeError("no slot found")
Enter fullscreen mode Exit fullscreen mode

Cron: let the system do the conversion

Many cron implementations accept a timezone line:

CRON_TZ=Asia/Manila
30 19 * * * /usr/bin/python3 /opt/jobs/post_queue.py
Enter fullscreen mode Exit fullscreen mode

If yours does not, schedule in UTC and write the Manila time in a comment so the next person understands it.

Picking the slots themselves

Don't copy someone else's "best time to post" list blindly.

  • Start with three slots a day.
  • After two weeks, compare reach per slot from your platform insights.
  • Drop the weakest slot and test a new one.

For the bigger picture on Filipino audiences, platforms and content habits, this guide to social media marketing in the Philippines is a useful companion to the code above.

Found via https://boostingph.com while researching PH posting habits.

Written by MD Fozla Rabbi, SEO Specialist.

Top comments (0)