DateTime.Now.LongTimeString

.LongTimeString converts the time portion of the DateTime object and returns the time to the second. The results will be formatted as: hh:mm:ss. There is no am/pm value with this and the hour value will be between 0 and 23. To get the time to show am/pm you will need to use the Utility.FormatTime(Date[, Seconds]) method.

Note: The .Today method does not have a time component and will always return a 0.

Applies To

Properties and Methods

None

Available

The .LongTimeString property is available in:

  • 15.03.016
  • All newer builds

Type

String

Syntax

DateTime.Now.LongTimeString;

Parameters

None

Example

var ldToday = DateTime.Today;

var ldNow = DateTime.Now;

var ldNew = new DateTime('06/10/2021 12:34:56');

Event.Form.MessageBox('Get the .LongTimeString:' +

'\nldToday: ' + ldToday.LongTimeString +

'\nldNow: ' + ldNow.LongTimeString +

'\nldNew: ' + ldNew.LongTimeString);

 

/* Expected Prompt response:

Get the .LongTimeString:

ldToday: 00:00:00

ldNow: 13:11:05

ldNew: 12:34:56

*/