⚙ī¸getTime()

Global function getTime()

Saaster offers a ready-to-use function for each user's correct time zone.

Saaster sets the current time zone to UTC 0 by default. The getTime() function then converts the user's time based on their input or IP. This function is only available with a customer session.

Please always save your times to the database using the Lucee function now() and NOT with the SQL function NOW().

The component contains (among others) the following two functions:

  • utc2local

  • local2utc

If you now want to display the user's date and time (now) anywhere in the world, use this function:

lsDateFormat(getTime.utc2local(utcDate=now()));
lsTimeFormat(getTime.utc2local(utcDate=now()));

If you now want to display the date and time from a db entry, use this function:

lsDateFormat(getTime.utc2local(utcDate=qTable.theDate));
lsTimeFormat(getTime.utc2local(utcDate=qTable.theDate));

Reminder: The date and time in the database is stored in UTC 0.

Last updated