Skip to main content

Date

The Date function returns the equivalent date of the input string.

Prototype

    Date(String; Format; DateType)

Arguments

    String        String       By value

A literal, an expression or a variable (Studio only) containing a valid date.

Format String By value

A string that defines the format of the String parameter (string representation of a date).
See Format Key.

DateType String By value

A literal, an expression or a variable (Studio only) containing a valid date type.
See DateType.

Returns

    Date

The Date in UTC format

Exception

    Undefined

Undefined is returned if:
- String parameter is Undefined or is not a String.
- Format parameter is not valid.
- Format parameter is not defined and String parameter is not a valid Date.

Format Key

Format KeyDescription
dThe day of the month from 1 through 31
ddThe day of the month from 01 through 31
MThe month from 1 through 12
MMThe month from 01 through 12
yyThe year in two digit format
yyyyThe year in four digit format
HThe hour from 0 through 23
HHThe hour from 00 through 23
mThe minute from 0 through 59
mmThe minute from 00 through 59
sThe second from 0 through 59
ssThe second from 00 through 59

Examples

  • dd-MM-yyyy HH:mm:ss

  • MM/dd/yyyy HH:mm:ss

Using predefined formats (no case sensitive) without separators

  • mmyyyy

  • mmyyyyhhmmss

  • yyyymm

  • yyyymmhhmmss

  • ddmmyyyy

  • ddmmyyyyhhmmss

  • mmddyyyy

  • mmddyyyyhhmmss

  • yyyymmdd

  • yyyymmddhhmmss

  • yyyyddmm

  • yyyyddmmhhmmss

Empty format string

If the format parameter is empty the following standard formats will be used to parse the String parameter.

  • myyyy

  • mmyyyy

  • mddyyyy

  • mmddyyyy

DateType

Supported Data Types (not case sensitive):

DateTypeDescription
SFhubDate and time will be converted using the time zone of the SFHub application server.
SFServerDate and time will be converted using the time zone of the Sigmafine Server.
UserDate and time will be converted using the time zone of the user evaluating the function.
UtcDate and time are assumed in UTC format.
Empty or missedDate and time will be converted using the time zone of the SFHub application server.
info

If omitted, the date is converted to the SFHub time zone (default timezone).

Example 

  Date ('052020' ; '')

The standard format mmyyyy is automatically applied. It will return 05/01/2020 0:0:0 UTC.

  Date ('52020' ; '')

The standard format myyyy is automatically applied. It will return 05/01/2020 0:0:0 UTC.

info

Notice that the date is enclosed in single quotes; this is because the first character is a zero.

  Date('20200502';'yyyyMMdd')

Will return 05/01/2020 22:00:00 UTC.

  Date('20200502';'yyyyMMdd' ; 'User')

The date is assumed as local to the user's time zone and then converted into UTC. In our case the time zone of the user is GMT +1

Note

Notice that if the user's time zone is the same of the SFHub application server and of the Sigmafine server the resulting date will be the same also using different date types

  Date('20200502';'yyyyMMdd' ; 'SFhub')
  Date('20200502';'yyyyMMdd' ; 'SFServer')