Skip to main content

Regular Expressions: How to Remove Leading Zeros from Dates

Written by Yuki Omori

📝 Overview

This guide shows you how to remove leading zeros from single-digit months and days in date formats such as 2023/07/01 [yyyy/mm/dd] and 2023-07-01 [yyyy-mm-dd].


🛠️ How to Set Up

Operation / Action to Use

  • Operation: Manipulate/Transform Data

  • Action: Data Replacement Using Regular Expressions

Text to Replace

Enter the date to be converted or the output value obtained from a previous operation.

Text to Find (Regular Expression)

Enter a regular expression that matches the target string.

① yyyy-mm-dd

(?<=-)(0|!10|!20|!30)

② yyyy/mm/dd

(?<=/)(0|!10|!20|!30) 

Replacement Text

Leave this field blank.

👇🏻 Example: Converting 2024/08/10 to 2024/8/10

That’s it!

Your dates are now clean, concise, and perfectly formatted for your needs. 🎉


📚 Related Guides

Search Keywords

regular expression, remove leading zero, date formatting, data transformation, regex help

Did this answer your question?