4D Blog

Home Product Dates inside objects!

Dates inside objects!

January 23, 2018

Product

Objects are great! Their flexibility, combined with speed and elegance, make them a first choice for most developers. Using dates inside objects is now easier and more intuitive. From now on, dates can be set as dates – and not strings inside objects!

How does it work?

In order to use dates inside objects, just check the compatibility setting, “Use date type instead of ISO date format in objects”, in the Database Settings.

Once this is done, OB SET and OB Get work without requiring the is date constant.

OB SET ($myObject;"myDate";$date)
$date:=OB Get ($myObject;"myDate")

Object Notation also works! Take a look:

$myObject.myDate:=$date
$date:=$myObject.myDate

Stringify and Parse

Compatibility is maintained

Prior to 4D v16 R6, when calling the JSON Stringify command, objects containing dates were systematically “stringified” according to the ISO 8601 normalization in the following format “YYYY-MM-DDThhmmss.sssZ” . The reverse operation, JSON Parse, did not interpret this format by default, and therefore produced a string.

What’s new?

If the compatibility option in the Database Settings is checked, dates will simply be formatted as “YYYY-MM-DD” (still following the ISO 8601 standard) when calling the JSON stringify command. When using JSON Parse, this string will then be set as a date (and not as a string) inside the object!

Change mode dynamically

If needed, this default setting can be changed by programming with the SET DATABASE PARAMETER command and the Dates inside object selector.

Reminder: SET DATABASE PARAMETER(Dates inside object;option) is local to the current process.

The three possible values for this option are now:

  • String type without time zone  (previously known as ignore local time zone)
  • String type with time zone  (previously known as take time zone into account)
  • Date type (new!)

As a result, when you import JSON data into 4D, you now have a way to dynamically change the format for dates.

Discuss

Tags Database, Objects, Programming, v16 R6, v17

Latest related posts

  • February 3, 2026

    4D Write Pro – Adding a margin automatically when bullets are set using standard actions

  • January 22, 2026

    Transform Static Documents into Actionable Knowledge with AIKit

  • January 22, 2026

    Deploy Fluent UI effortlessly in your 4D applications

Roland Lannuzel
Roland Lannuzel
• Product Owner & 4D Expert • After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • AI
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy