4D Blog

Home Product Times inside objects… (and everywhere else)

Times inside objects… (and everywhere else)

June 1, 2018

Product

Objects are at it again, continuing to demonstrate their utility to ease your life as a developer.

Using time (or duration) values inside of objects is now smoother and more intuitive. Beginning with 4D v17, times inside objects are set as seconds  – and not milliseconds!

This was not previously visible for users because OB SET and OB Get had to be used with the is time constant, so the conversions were made automatically.

OB SET ($myObject;"myTime";$time;is time)
$time:=OB Get ($myObject;"myTime";is time)

Now, this constant is no longer mandatory. The code above can be shortened, but even more importantly, object notation can be used as well!

$myObject.myTime:=$time
$time:=$myObject.myTime

TIME IN OTHER CONTEXTS

QUERYING OBJECT FIELDS

  • From now on, when querying an object field with QUERY BY ATTRIBUTE, comparisons between number and a time values are performed in seconds instead of milliseconds.

 

Here are two examples which produce the same result:

QUERY BY ATTRIBUTE([Table_1];[Table_1]z;"time";"=";?12:00:00?)

QUERY BY ATTRIBUTE([Table_1];[Table_1]z;"time";"=";12*60*60)

 

WEB AREA

  • When calling JavaScript in a web area, conversion to and from a time is performed in seconds instead of milliseconds when using:
    • WA Evaluate JavaScript
    • WA EXECUTE JAVASCRIPT FUNCTION
    • $4d bridge

COMPATIBILITY CAN BE MAINTAINED EASiLY

If necessary for existing databases, this default setting can be changed with the SET DATABASE PARAMETER command and the Times inside objects selector.

There are two available values for this option:

  • Times in milliseconds
  • Times in seconds

This database parameter is applied to the database itself, not just the current process. To maintain compatibility or help the migration process, this command can be called during the On Startup Database Method.

 

Discuss

Tags Database, Objects, Programming, v17

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

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
  • 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-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 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