Version:
  1. Date functions

    Article: AN0002150 Displayed: 1190x

     

    Function name and parameters Function description
    ActualDate() Returns actual date and time. (Returned value is data type date.)
    GetDatePart(date, datepart) Returns respective part of the input value of the first parameter (time) according to the second parameter. (Returned value is data type integer.)

    Parameter datepart can gain these values:

    'day'
    'month'
    'year'
    'second'
    'minute'
    'hour'
    AddDate(date, type, value) Adds value from the third parameter, which is interpreted according to the second parameter, to the value according to the first parameter.. (Returned value is data type date.)

    Parameter type may gain following values:

    'day'
    'month'
    'year'
    'second'
    'minute'
    'hour'


    Example:

    AddDate(ActualDate(), 'hour', -3) – returns actual time minus 3 hours

    MoveDate( date, type) Returns date according to the parameter type related to the date from the parameter date . (Returned value is data type date.)

    Parameter type can gain these values:

    'FirstDayInMonth'
    'FirstDayInYear'
    'FirstDayInQuarter'
    'FirstDayNextQuarter'
    'LastDayInMonth'
    'LastDayInYear'
    'LastDayInQuarter'
    'PreviousMonday'
    'PreviousFriday'
    'PreviousSunday'
    'NextMonday'
    'NextFriday'
    'NextSunday'

    Eaxmple:

    MoveDate(ActualDate(), 'NextMonday') - returns date of the next Monday.

    DayInWeek(date) Returns order of the day date in the week – Monday = 1, Sunday = 7. (Returned value is data type integer.)
    CreateDate(year, month, day) Returns order of the day date in the week – Monday = 1, Sunday = 7. (Returned value is data type integer.)
    CreateDate(year, month, day, hour, minute, second) Returns date according to the input parameters. (Returned value is data type date.)
    DateDiff(type, date1, date2) Returns the difference in two dates: date1-date2.

    When parameter type Days, Hours, Minutes or Seconds is used, it returns a partial difference in date parts according to the input parameter type. (Returned value is data type integer.)

    When parameter type TotalDays, TotalHours, TotalMinutes or TotalSeconds is used, it returns the total difference in units of days, hours, minutes or seconds. (Returned value is data type float.)

    Returns difference in date parts according to the input parameter type: date1-date2.

    (Returned value is data type integer.)

     

    Example:

    DateDiff('Minutes',#2012.02.14 14:45:35#,#2012.01.15 14:59:36#) –  returns: 45

    DateDiff('Seconds',#2012.02.14 14:45:35#,#2012.01.15 14:59:36#) – returns: 59

    DateDiff('Days',#2012.01.14 14:45:35#,#2012.01.15 14:59:36#)

    – returns: -1

    DateDiff('Days',#2012.01.14 14:45:35#,#2012.01.15 14:44:36#)

    – returns: 0

     

     

    DateDiff('TotalSeconds',#2012.01.14 14:45:00#,#2012.01.14 14:46:41#)

    – vrátí: 101

    DateDiff('TotalMinutess',#2012.01.14 14:45:00#,#2012.01.14 14:46:41#)

    – vrátí: 1,68333333
    CDate(text, format) Converts input parameter text to a datetime data type. (Returned value is data type date.)

    Example: CDate(column('xx'), 'dd.MM.yyyy HH:mm:ss')

    Description of formats is on:

    1. http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
    2. http://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.71).aspx

     

  2.    ---
    Your rating:
    Rated by users: 0x
  3. Top
SearchTitle
×