Websites, apps & code / Coding & debugging
Dates and times come out wrong
Your program is off by a day, or the time is eight hours away from Malaysian time.
1Fill in your details
Leave blank to use the example. Names are remembered for other prompts too (stored only on your device).
3Copy the prompt
My program gets dates and times wrong. Please find the cause and fix it. What is wrong: An order placed at 11pm is recorded as the next day, and the report's "today" is one day short Related code: const d = new Date(order.created); const day = d.toISOString().slice(0,10); Where it runs: Use JavaScript and explain why browser and server time zones differ. Please: 1. First explain the usual causes: time zones (Malaysia is UTC+8 with no daylight saving), the hours around midnight and format conversions. 2. Point to the exact line in my code that causes it. 3. Give the fixed code and verify it with three examples, including 23:30 and 00:30 as edge cases. 4. Tell me what format to store times in from now on so this is less likely to happen. 5. If you lack information, ask me first instead of guessing. Do not change features I did not mention. [Make it sound human] - Explain in plain words; no pleasantry openers or empty summaries. - Only necessary, short, practical code comments; the simplest working approach, no over-engineering. - Interface text (buttons, hints, error messages) should sound like a person wrote it; no "seamless", "empower", "unlock". [Quality] Code must run as is and handle common errors; tell me how to test it and confirm it works; ask first if a requirement is unclear; never put passwords or API keys in the code.
Paste it into ChatGPT, Gemini, Claude or Meta AI.
Test result
AI tools that suit this
- Claude Suggested tool Free plan
Strong at long documents, editing and code
- ChatGPT Suggested tool Free plan
The most widely used AI chat, for writing, questions and images
- Gemini Suggested tool Free plan
Google's AI; generates and edits images, works with Gmail and Docs
Recommendations only, not sponsored. Check each site for what the free plan includes.
This site is made by FullMark Tech
Want your own website, or your shop spreadsheets automated? FullMark Tech builds business websites and custom Excel tools.