This prompt is for ETL developers and data engineers who need to convert free-text date expressions into a strict, machine-readable ISO 8601 format before ingestion into a data warehouse, event stream, or operational database. The core job is to take an unpredictable string like 'Jan 1st', 'next Tuesday', or 'Q4 2024' and produce a predictable output like 2024-01-01 with clear provenance. The ideal user is building a data pipeline where downstream systems—analytics dashboards, financial models, or scheduling services—will break if they receive non-standard date formats.
Prompt
Date Normalization Prompt Template

When to Use This Prompt
Define the job, the ideal user, and the boundaries for the Date Normalization Prompt Template.
Use this prompt when the input text is unstructured and the date format is unknown in advance. It is designed for batch or streaming record normalization where each record must be processed independently. The prompt includes explicit instructions for handling relative dates by requiring a reference date, and it demands a confidence flag for ambiguous expressions like 'next Friday' when the reference date is unclear. Do not use this prompt for simple format casting where a deterministic parser like Python's dateutil would suffice; the model's strength is in resolving linguistic ambiguity, not in replacing a strptime call. Avoid using it for date arithmetic or scheduling logic—this prompt normalizes, it does not calculate intervals or recurrences.
Before wiring this into a production pipeline, ensure you have a clear contract for what happens when the model returns null or a low-confidence flag. The prompt is designed to surface uncertainty rather than guess silently, which means your application code must handle these cases—by routing to a manual review queue, applying a default, or rejecting the record. The next section provides the exact prompt template you can copy, adapt, and embed in your extraction harness.
Use Case Fit
Where the Date Normalization Prompt Template works well and where it introduces risk. Use these cards to decide if this prompt fits your pipeline before you integrate it.
Good Fit: Free-Text Date Ingestion
Use when: You are ingesting dates from unstructured sources like emails, chat logs, or scraped text where formats are unpredictable ('Jan 1st', 'next Tuesday', 'Q4 2024'). Guardrail: The prompt expects a source string and a reference date for relative expressions. Always provide both to avoid silent misinterpretation.
Bad Fit: Strictly Formatted Database Migrations
Avoid when: Your source data is already in a known, consistent date format (e.g., all values are 'YYYY-MM-DD'). Risk: Using an LLM for deterministic parsing adds latency, cost, and a non-zero chance of hallucination. Guardrail: Use a simple parsing library or regex for known formats; reserve this prompt only for the dirty, free-text remainder.
Required Inputs: Reference Date and Timezone Context
Risk: Relative expressions like 'next Tuesday' or 'end of this month' are ambiguous without a known 'today'. Guardrail: The prompt template requires a [REFERENCE_DATE] placeholder. For global applications, also provide a [TIMEZONE] to resolve edge cases around midnight and month boundaries correctly.
Operational Risk: Ambiguous Date Expressions
Risk: Inputs like '01/02/2024' are ambiguous (MM/DD vs DD/MM). The model may guess based on surrounding text or default to US formats, leading to incorrect ISO 8601 output. Guardrail: The prompt must return a confidence flag and ambiguity_notes field. Route low-confidence results to a human review queue before they land in your database.
Operational Risk: Missing or Null Inputs
Risk: An empty string or 'N/A' input can cause the model to hallucinate a date or return a generic error that breaks your ETL schema. Guardrail: The prompt template includes explicit null handling instructions. It must return a structured null_reason field (e.g., 'MISSING', 'EXPLICIT_NULL') instead of a date string. Validate this field in your pipeline.
Downstream Contract: ISO 8601 with Source Annotation
Risk: Downstream systems may silently accept a well-formed date that is semantically wrong. Guardrail: The prompt's output schema requires not just the normalized_date (ISO 8601) but also the original_text and normalization_rule applied. Persist all three fields to make every transformation auditable and reversible.
Copy-Ready Prompt Template
A reusable prompt template for converting free-text date expressions into ISO 8601 with source annotation and confidence flags.
This prompt template is the core instruction you send to the model for every date normalization task. It accepts a raw date string, optional context, and a set of constraints, then returns a structured JSON payload containing the normalized ISO 8601 date, the original source text, a confidence score, and a rationale. Use it as the foundation for your ETL pipeline's date normalization step.
textYou are a date normalization engine. Your job is to convert free-text date expressions into ISO 8601 format (YYYY-MM-DD) with source annotation and confidence flags. INPUT: - raw_date: "[RAW_DATE_STRING]" - context: "[CONTEXT]" - reference_date: "[REFERENCE_DATE]" OUTPUT_SCHEMA: Return a single JSON object with these fields: - normalized_date: string | null // ISO 8601 YYYY-MM-DD, or null if no date found - original_text: string // the exact input substring that was interpreted - confidence: "high" | "medium" | "low" - rationale: string // brief explanation of the normalization decision - alternative_interpretations: string[] // other plausible dates, if ambiguous CONSTRAINTS: - If the input contains no recognizable date, set normalized_date to null and confidence to "low". - For relative expressions like "next Tuesday" or "tomorrow", use the reference_date to compute the absolute date. - For quarter expressions like "Q4 2024", resolve to the first day of the quarter (2024-10-01) and note the quarter interpretation in the rationale. - For ambiguous formats like "01/02/2024", prefer the locale hint in context if provided; otherwise flag as ambiguous and list alternatives. - Do not hallucinate dates. If only a year is given ("2024"), return null with a rationale. - Preserve the original text exactly as it appears in the input. [EXAMPLES] Input: raw_date="Jan 1st, 2024", context="", reference_date="2024-06-15" Output: {"normalized_date":"2024-01-01","original_text":"Jan 1st, 2024","confidence":"high","rationale":"Standard month-day-year format with ordinal indicator removed.","alternative_interpretations":[]} Input: raw_date="next Tuesday", context="email sent on Monday", reference_date="2024-06-17" Output: {"normalized_date":"2024-06-25","original_text":"next Tuesday","confidence":"high","rationale":"From reference date Monday 2024-06-17, next Tuesday is 2024-06-25.","alternative_interpretations":[]} Input: raw_date="Q4 2024", context="fiscal calendar", reference_date="2024-06-15" Output: {"normalized_date":"2024-10-01","original_text":"Q4 2024","confidence":"medium","rationale":"Resolved to first day of Q4. If fiscal calendar differs, adjust reference_date context.","alternative_interpretations":["2024-10-01 (calendar Q4)","2024-11-01 (fiscal Q4 if offset)"]} Input: raw_date="sometime next year", context="", reference_date="2024-06-15" Output: {"normalized_date":null,"original_text":"sometime next year","confidence":"low","rationale":"Expression is too vague to resolve to a specific date.","alternative_interpretations":[]}
To adapt this template for your pipeline, replace the square-bracket placeholders with your actual values at runtime. The [RAW_DATE_STRING] is the free-text date you need to normalize. The [CONTEXT] field should carry any surrounding text, locale hints, or domain signals (e.g., "fiscal calendar", "US format") that help disambiguate the date. The [REFERENCE_DATE] must be today's date or the document's effective date in ISO 8601 format—this is critical for resolving relative expressions correctly. The [EXAMPLES] section can be expanded with domain-specific edge cases you encounter in your own data. If your downstream system requires a different output schema, modify the OUTPUT_SCHEMA block but keep the confidence and rationale fields to preserve auditability.
Before deploying this prompt into production, validate the output against a golden dataset of known date expressions and their expected ISO 8601 values. Pay special attention to locale-sensitive formats (MM/DD vs DD/MM), quarter boundaries, and relative date resolution around month and year transitions. For high-risk workflows such as financial reporting or legal document processing, route all low-confidence results to a human review queue and log the full prompt-response pair for audit.
Prompt Variables
Inputs the Date Normalization Prompt needs to work reliably. Wire these placeholders into your ETL pipeline before calling the model.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[RAW_DATE_STRING] | The free-text date expression to normalize | Jan 1st, next Tuesday, Q4 2024 | Required. Non-empty string. Reject null or whitespace-only input before prompt assembly. |
[REFERENCE_DATE] | Anchor date for resolving relative expressions like 'next Tuesday' or 'tomorrow' | 2024-11-15 | Required for relative date resolution. Must be ISO 8601 date string. If missing, relative expressions will fail with low confidence. |
[LOCALE_HINT] | Locale code to disambiguate date formats like MM/DD vs DD/MM | en-US, en-GB, de-DE | Optional. Use ISO 639-1 + ISO 3166-1 alpha-2 format. Null allowed. Without it, ambiguous numeric dates get a confidence penalty. |
[OUTPUT_TIMEZONE] | IANA timezone for normalizing timestamps to a consistent zone | America/New_York, UTC | Optional. Default to UTC if null. Must be valid IANA timezone string. Invalid values cause normalization failure. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for automated acceptance; below this routes to human review | 0.85 | Required. Float between 0.0 and 1.0. Outputs with confidence below this value should be flagged for review, not silently ingested. |
[ALLOWED_DATE_RANGE] | Valid date range constraint to catch extraction errors or out-of-domain values | 2020-01-01 to 2030-12-31 | Optional. Two ISO 8601 dates separated by 'to'. Dates outside this range get a validity flag but are still returned for audit. |
[AMBIGUITY_POLICY] | Instruction for handling ambiguous expressions: 'flag', 'best_guess', or 'reject' | flag | Required. Enum: flag, best_guess, reject. Controls whether ambiguous dates get a best-effort parse with low confidence or are rejected outright. |
Implementation Harness Notes
How to wire the date normalization prompt into a production ETL pipeline with validation, retries, and audit logging.
The date normalization prompt is designed to sit inside a data ingestion or ETL pipeline where free-text date fields arrive from multiple upstream sources—web forms, CSV exports, legacy databases, or document extraction outputs. The prompt itself is stateless and expects a single input text plus optional context such as a reference date or locale hint. In production, you will typically wrap this prompt in a thin service or serverless function that accepts a batch of records, calls the LLM for each record (or in small batches if your provider supports it), and processes the structured JSON response. Because date normalization is deterministic in principle but ambiguous in practice, the implementation harness must handle three things well: input preparation, output validation, and ambiguous-case routing.
Input preparation starts with assembling the prompt variables. The [INPUT] placeholder should receive the raw date string exactly as it appears in the source field—do not pre-clean or trim unless your pipeline has a separate cleaning step with its own audit trail. The [REFERENCE_DATE] should default to the current date at ingestion time unless your use case requires a fixed reference (e.g., fiscal year boundaries). The [LOCALE_HINT] should be derived from a known field such as the user's country code, the document language, or a system configuration value; when unavailable, pass "unknown" and let the model flag ambiguity. The [OUTPUT_SCHEMA] placeholder should contain a compact JSON Schema or TypeScript interface definition that matches your downstream contract—at minimum, fields for normalized_date (ISO 8601 or null), confidence (a float between 0.0 and 1.0), resolution_notes (a short string explaining the normalization decision), and requires_review (boolean). The [CONSTRAINTS] placeholder should encode business rules such as acceptable date ranges, handling of future dates, and whether partial dates like "Q4 2024" should resolve to a start date, end date, or be rejected.
Output validation is critical because even well-structured prompts can produce malformed JSON, dates outside acceptable ranges, or confidence scores that don't match the resolution notes. After receiving the model response, run a validation layer that checks: (1) valid JSON parse, (2) presence of all required fields, (3) normalized_date is either null or a valid ISO 8601 string, (4) confidence is a number between 0 and 1, (5) requires_review is boolean, and (6) if requires_review is false but confidence is below your threshold (e.g., 0.85), flag the record anyway. On validation failure, implement a retry strategy: re-submit the same input with an error message appended to the prompt explaining what went wrong, up to a maximum of 2 retries. After the final retry, if validation still fails, route the record to a dead-letter queue or manual review bucket with the raw model output and validation errors attached. For high-throughput pipelines, consider using a cheaper/faster model for the initial pass and escalating to a more capable model only when confidence is low or validation fails—this is a model routing pattern that reduces cost while maintaining quality.
Logging and audit requirements for date normalization are often underestimated. Every normalization decision should produce an audit record containing: the raw input string, the reference date and locale hint used, the model ID and prompt version, the raw model response, the validated output, the retry count, and the final routing decision (accepted, sent to review, or dead-lettered). Store these audit records in a structured log system or database table that your data governance team can query. For regulated environments, ensure that human reviewers can see the original text alongside the normalized output and the model's resolution notes. The resolution_notes field in the output schema is your primary tool for explainability—instruct the model to be specific (e.g., "Resolved 'next Tuesday' relative to reference date 2025-01-15 as 2025-01-21") rather than vague ("Relative date resolved"). When building the review interface, display low-confidence records sorted by confidence score and allow reviewers to accept, override, or reject the normalization with a single click, feeding corrections back into your evaluation dataset for future prompt improvements.
Common Failure Modes
Date normalization prompts fail in predictable ways. Here's what breaks first and how to guard against it in production ETL pipelines.
Ambiguous Relative Dates
What to watch: Expressions like 'next Tuesday' or 'end of month' resolve differently depending on the reference date. If the reference date is missing or stale, the model guesses—often incorrectly. Guardrail: Always inject the current system date as a mandatory [REFERENCE_DATE] variable. For batch processing historical documents, pass the document creation date, not today's date.
Silent Null Injection
What to watch: When no date is present in the input, the model may hallucinate a plausible date instead of returning null. This contaminates downstream systems with fabricated timestamps. Guardrail: Explicitly instruct the model to return null for the normalized value when no date is detected. Add a post-processing validator that rejects any output where the source span is empty but a date is present.
Format Drift Under Load
What to watch: The model starts returning YYYY-MM-DD for simple cases but drifts to Month DD, YYYY or other formats when inputs get complex or the context window fills. This breaks downstream ISO 8601 parsers. Guardrail: Use a strict output schema with a regex validator on the normalized field. Add a format compliance check in the eval harness that runs against every batch.
Fiscal Year Misalignment
What to watch: 'Q4 2024' could mean calendar Q4 (Oct–Dec 2024) or fiscal Q4 depending on the organization's fiscal calendar. The model defaults to calendar quarters unless instructed otherwise. Guardrail: Pass the organization's fiscal year start month as a [FISCAL_YEAR_START] parameter. For multi-tenant systems, make this a required configuration field per data source.
Confidence Score Inflation
What to watch: The model assigns high confidence to dates it parsed correctly but also to dates it guessed from weak signals. Confidence scores become unreliable for routing decisions. Guardrail: Require the model to justify its confidence with a specific reason. Calibrate scores against a golden test set. Route any date with confidence below 0.85 and no explicit source span to human review.
Locale Ambiguity in Numeric Dates
What to watch: '01/02/2024' is January 2nd in the US but February 1st in most other locales. The model defaults to US interpretation unless locale context is provided, causing silent misalignment for international data. Guardrail: Always pass a [LOCALE] or [DATE_ORDER] parameter (MDY, DMY, YMD). When locale is unknown, flag the date with low confidence and return both possible interpretations in the ambiguity notes.
Evaluation Rubric
Use this rubric to test the Date Normalization Prompt before shipping. Each criterion targets a specific failure mode common in free-text date parsing. Run these tests against a golden dataset of ambiguous, missing, and edge-case date strings.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
ISO 8601 Format Compliance | Output date string strictly matches YYYY-MM-DD format | Output contains ordinal suffixes (1st), written months (January), or alternate separators (/) | Regex validation against ^\d{4}-\d{2}-\d{2}$ on 50 varied inputs |
Relative Date Resolution | Relative expressions resolve to correct calendar date given [REFERENCE_DATE] | next Tuesday resolves to wrong weekday or off-by-one error | Test 10 relative expressions with known reference date; compare against ground truth |
Fiscal Quarter Mapping | Q4 2024 maps to correct start date per [FISCAL_CALENDAR_START] configuration | Quarter mapped to calendar-year assumption instead of configured fiscal year | Test all 4 quarters with non-January fiscal start; verify against manual calculation |
Null Handling for Missing Dates | Empty or whitespace-only [INPUT] returns null with source_absent flag | Model hallucinates a date or returns empty string instead of null | Feed 10 empty/missing inputs; assert output is null and source_absent is true |
Ambiguity Confidence Flagging | Ambiguous expressions set confidence below [CONFIDENCE_THRESHOLD] and populate ambiguity_reason | Ambiguous input returns high confidence or missing ambiguity_reason field | Test inputs like 01/02/2025 (MM/DD vs DD/MM) and next Friday near week boundary; check confidence field |
Source Annotation Completeness | Every output includes original_text, resolved_date, confidence, and ambiguity_reason fields | Missing original_text field or null ambiguity_reason on ambiguous input | Schema validation against [OUTPUT_SCHEMA] on all test cases; assert required fields present |
Out-of-Range Date Rejection | Dates outside [MIN_DATE] to [MAX_DATE] range return null with out_of_range flag | Future date 100 years out accepted without flagging | Test with year 3024 and year 1024 inputs; assert null output with out_of_range reason |
Partial Date Handling | Month-only or year-only inputs return null with insufficient_precision flag unless [ALLOW_PARTIAL_DATES] is true | Model invents day for month-only input or returns truncated ISO string | Test January 2024 and 2024 inputs; verify null or partial flag behavior matches config |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a frontier model and minimal post-processing. Remove the strict JSON schema requirement and ask for a simple key-value output. Focus on getting the normalization logic right before adding validation layers.
codeNormalize the following date expression to ISO 8601 (YYYY-MM-DD). If the date is ambiguous, return your best guess and flag it. If no date is present, return null. Date: [INPUT]
Watch for
- Model inventing dates when none exist instead of returning null
- Inconsistent handling of relative dates like 'next Tuesday'
- Quarter formats (Q4 2024) being interpreted as a single day rather than a range
- No confidence signal to distinguish high-certainty from low-certainty parses

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us