Date Format Playground — Code Snippets for JS, PHP, Python, Java, Go, SQL | tick.pro
Pick a date/time and timezone to get correct, copy-ready formatting and parsing snippets for JavaScript, PHP/Laravel, Python, Java, Go, MySQL, and PostgreSQL, with explicit timezone, precision, and naive-vs-aware caveats. Runs locally in your browser.
Date Format Playground (local-only)
Selected instant (same moment, shown in multiple forms)
Important differences (read before copying)
- Timezone-aware vs naive: some types store an absolute instant with an offset/zone (e.g. JS Date, Python aware datetime, Java Instant/ZonedDateTime, PostgreSQL timestamptz) while others are wall-clock/naive (MySQL DATETIME, PostgreSQL timestamp, Java LocalDateTime, Python naive datetime). Do not mix them without an explicit zone.
- Seconds vs milliseconds: Unix epoch is often seconds (10 digits) in APIs/databases but milliseconds (13 digits) in JavaScript Date/Java Instant math. Converting without the right unit shifts the time by ~1000x.
- JavaScript months are 0-based: Date constructors/getMonth() use 0=January..11=December (display months are 1-based). Other languages shown here use 1-based months.
- Formatting tokens differ: PHP date()/Carbon, Python strftime, Java DateTimeFormatter, Go reference-layout, and SQL functions use different pattern letters—tokens are not interchangeable.
- Not executed here: snippets are illustrative for the selected instant; library versions, locales, server/DB timezone settings, and DST rules can affect results.
Frequently Asked Questions
Are the snippets executed or verified against a runtime?
Snippets are generated in your browser for the selected instant and timezone using labeled formatting rules and common APIs. They are copy-ready examples, but runtime behavior can vary by library/version/locale/database settings—review the caveats (timezone, seconds vs milliseconds, naive vs aware types) before using them in production.
Does this tool send my selected date anywhere?
No. The playground runs entirely in your browser and does not transmit the inputs you enter.
Why do timezone and naive/aware types matter?
Some types represent an absolute instant (UTC/offset-aware) while others store wall-clock time with no zone. Mixing them or assuming a server/database timezone can shift results; snippets and caveats label these assumptions explicitly.
curl https://tick.pro/formats/date-playground