createDateTime (NotesSession - JavaScript)

Creates a NotesDateTime object that represents a specified date and time.

Defined in

NotesSession

Syntax

createDateTime(date:string) : NotesDateTime

createDateTime(date:Date) : NotesDateTime

Parameter Description
date:string The date and time you want the object to represent. See NotesDateTime for formats. An invalid date-time or empty string results in an error.
date:java.util.Date The date and time you want the object to represent.
Return value Description
NotesDateTime The newly created date-time.

Usage

See the NotesDateTime class for descriptions and more examples.

Examples

This computed field displays the number of days since the current database was created.
var t = database.getCreated();
var n = session.createDateTime("Today");
n.setNow();
return "Database created " + (n.timeDifference(t) / 86400).toFixed(0) + " days ago"