StringtoDateTime (PQL)

Converts a string of date and time into a date-time value that can be used for subsequent date-time operations.

  • Returned Output: Date-Time
  • Library: PQL \ Common \ Date-Time
  • Version: 2018.00.000
  • Compatibility:
    • Can be combined with and other PQL function throughout the application.
    • It CANNOT be used with MDX or VBA functions. But it can be used on MDX-based content in other parts of the application.

Syntax

StringtoDateTime( <Text> , OPTIONAL <Mask> )

* Click on the function's arguments above for more details on the input values.

Comments
  • The text string must be a reasonably valid expression of dates and time.
  • The text mask is an optional input that instructs the engine on how to read the string to construct the date or time.
  • If no time is supplied, a time of "00:00" is imputed.
  • The function produces a date-time value that can be used with other subsequent functions to manipulate date-time values.
Different Function types
  • This function is like the Excel DateValue function.
  • Also see the StringToDate function.

Examples

This example produce a date-time value for January 5th, 2018 2:55 pm

StringToDateTime("2018-01-05 14:55:00")

This example produce a date-time value for May 1st, 2018 2:55 pm

StringToDateTime("2018-01-05 14:55:00", "YYYY-DD-MM hh:mm:ss")

This example produce a date-time value for November 5th, 2019 12:00 am

StringToDateTime("2019-11-05")