Rob van der Woude's Scripting Pages

Help text for DateTimeBox.cs

(view help text of DateTimeBox.cs as plain text)

DateTimeBox,  Version 1.12
Batch tool to present a Date/Time Picker dialog and return the selected
date and/or time in the specified format

Usage:    DATETIMEBOX  [ "title" ]  [ "datetime" ]  [ options ]

Where:    "title"    is the optional caption in the title bar
                     (default: DateTimeBox,  Version 1.12)
          "datetime" is the optional initial date/time for the dialog
                     in "yyyy-MM-dd HH:mm" format      (default: now)
          options    /D   display and return Date only (default: date and time)
                     /T   display and return Time only (default: date and time)
                     /I24 Ignore AM/PM in Input on systems with 24-hour format
                     /O24 append AM/PM to Output on systems with 24-hour format
                     /FT:"file"          use File Timestamp of specified file
                                         for the dialog's initial date/time
                     /DD:dateformat      Date Display format (GUI)
                     /DO:dateformat      Date Output string format
                     /TD:timeformat      Time Display format (GUI)
                     /TO:timeformat      Time Output string format
                     /DTO:datetimeformat Date and Time Output string format
                     /DE:yyyy-MM-dd      Earliest Date allowed
                     /DL:yyyy-MM-dd      Latest Date allowed
                     /DMAX:numberofdays  MAXimum Date allowed, relative to
                                         today, in days (negative number for
                                         a date in the past)
                     /DMIN:numberofdays  MINimum Date allowed, relative to
                                         today, in days (negative number for
                                         a date in the past)
                     /H:height           window Height (default: 135,
                                         minimum: 135, maximum: screen height)
                     /I:index            use Icon at index from shell32.dll
                     /L[:captions]       Localize or customize button captions
                                         (e.g. /L:"OK=Why Not?;Cancel=Never!")
                     /W:width            window Width (default: 220,
                                         minimum: 220, maximum: screen width)

Example:  Display date/time in default format, output in yyyyMMddHHmmssfff
          format (year, month, day, hours, minutes, seconds, milliseconds),
          selected date between today and 90 days in the future:
          DATETIMEBOX "When?" /DTO:yyyyMMddHHmmssfff /DMIN:0 /DMAX:90

Notes:    Available custom date and time formats can be found on MSDN at:

          Note that by default AM/PM time formats ("tt" or "t") cannot be
          used on computers with a 24-hour time format. To prevent error
          messages, use /I24 to ignore "tt" or "t" (AM/PM) in specified input
          and/or output format, and /O24 to append AM/PM to the string on
          systems with 24-hour time format.
          If specified, the initial date/time must be in "yyyy-MM-dd HH:mm"
          or "yyyy-MM-dd HH:mm:ss" format; but with /D "yyyy-MM-dd" format is
          accepted, and with /T "HH:mm" and "HH:mm:ss" formats are accepted.
          If specified without captions, switch /L forces localized button
          captions (e.g. "Cancel" button caption is "Annuleren" on Dutch
          systems); if only a single custom caption is specified, the other
          one is localized (e.g. with /L:"OK=Gaan" on Dutch systems, "OK"
          button caption is "Gaan", "Cancel" button caption is "Annuleren").
          The selected date and/or time are written to Standard Out if "OK"
          is clicked, otherwise an empty string is returned.
          Switches /D, /T and /DTO are mutually exclusive.
          Return code 0 for "OK", 1 for (command line) errors, 2 for "Cancel".

Credits:  On-the-fly form based on code by Gorkem Gencay on StackOverflow:

          Code to retrieve localized button captions by Martin Stoeckli:

          Code to extract icons from Shell32.dll by Thomas Levesque:

Written by Rob van der Woude

page last uploaded: 2017-03-25, 21:31