utilities.Today
Overview¶
"Server Script" returns the date and time of 0:00 on the current day in UTC local time.
Syntax¶
Parameters¶
There are no parameters.
Return Value¶
Return the datetime of midnight on the current day in UTC local time. If executed on June 21, 2023, Japan time, "2023/06/20 15:00:00" will be returned.
Usage Examples¶
In the following example, the datetime of the day is entered into DateA. The server script will treat it as a UTC datetime, but after the server script ends, DateA will store the datetime converted to local time.
JavaScript¶
Code Samples¶
1. Set the label of a process button to today's date.
Sets the label of the button configured in the process to "Get data for {today's date}".
JavaScript¶
const dateFormat = (input) => {
if (!input) return '';
// The return value is a string, so convert it with new Date()
const date = new Date(input);
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(1, '0');
const d = String(date.getDate()).padStart(1, '0');
const dateTime = `${y}/${m}/${d}`;
return dateTime;
};
elements.LabelText('Process_1', `Get data for ${dateFormat(utilities.Today())}`);
Cautions¶
This is a method used in "Server Script". It cannot be used in "Script".
Supported Versions¶
- Pleasanter 1.1.39.0 or later
- Pleasanter .NET Framework version 0.50.263 or later