Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
NSC | Use REGEXP to convert a String to a Date
Use Case
User has a specific naming convention for their Lot Numbers: ABC-20231025-20211025 where 20231025 is the expiration date and 20211025 is the production date.
User needs to extract the expiration date with this format: MM/DD/YYYY.
Solution
To achieve the requirement, you can use these formula:
- If using Formula (Text):
(SUBSTR(REGEXP_SUBSTR({inventorynumber},'[^-]+$'),5,2)) || '/' || (SUBSTR(REGEXP_SUBSTR({inventorynumber},'[^-]+$'),7)) || '/' || (SUBSTR(REGEXP_SUBSTR({inventorynumber},'[^-]+$'),1,4))
- If using Formula (Date):
TO_DATE(((SUBSTR(REGEXP_SUBSTR({inventorynumber},'[^-]+$'),5,2)) || '/' || (SUBSTR(REGEXP_SUBSTR({inventorynumber},'[^-]+$'),7)) || '/' || (SUBSTR(REGEXP_SUBSTR({inventorynumber},'[^-]+$'),1,4))),'MM/DD/YYYY')
Learn how to Refer A Member | Earn the Answer Accepter Badge | Be the Content Creator of the Quarter | Vote for the content you want to see!
