Documentation > CMS Template API Library > Input > ShowSelectDateTime(String,String,Boolean,Boolean,Boolean,String,String,Boolean)
ShowSelectDateTime
Shows a date and time selector control. Dates and times are stored in the format "MM/dd/yyy HH:mm:ss" (24-hour time).
public System.Void ShowSelectDateTime(String,String,Boolean,Boolean,Boolean,String,String,Boolean)
Parameters
Name | Description | Type |
---|---|---|
label | The label of the field when displayed. | System.String |
fieldName | The field name where the value will be stored. | System.String |
convertToUTC | Optional: defaults to false. If true, converts from user time to UTC on save (and converts from UTC on re-edit) for parity with VB's showSelectGMT. | System.Boolean |
use24Hour | Optional: defaults to false. If true, the hour dropdown is 00-23 instead of 01-12 and an am/pm dropdown. | System.Boolean |
readOnly | Optional: defaults to false. Make the text box read only. | System.Boolean |
helpMessage | Optional: help message | System.String |
popupMessage | Optional: The popup help message. | System.String |
alwaysSend | Optional: If true, the value of the field will always be sent from the frontend to the backend regardless of whether its state has changed. | System.Boolean |
Code Example
C#
Sample:
// A basic date/time control Input.ShowSelectDateTime("Date/Time", "datetime"); </code> <code lang="C#"> <![CDATA[ // Parsing a datetime in output.aspx DateTime datetime; if (DateTime.TryParseExact(asset["datetime"], "MM/dd/yyy HH:mm:ss", out datetime)) { bool isPM = datetime.Hour >= 12; }