Home | About SQeeL | Document | DownLoad | Mail Japanese
Home > Document > SQeeL Reference

Date operation function

  • Built-in function
  • bintime()
    Description
    Converts a given date and time into the number of seconds since the epoch (00:00:00, January 1, 1970)
    Last updated time is converted to time localized for the standard Greenwich time zone and calculated
    Syntax
    ret = bintime(date,time)
    Parameters
    date:Specify the date in YYYYMMDD.
    time:Specify the time in HHMMSS.
    Return Value
    1 or more:Converted time (seconds)
    0:Error or converted time (seconds)
    System Return Value
    ERROR
    0Success
    1Argument error
    Example
    Topへ
    curtime()
    Description
    Returns the current time in the number of seconds since the epoch (00:00:00, January 1, 1970)
    Syntax
    ret = curtime()
    Return Value
    0 or more:Current time
    System Return Value
    ERROR
    0Success
    Example
    Topへ
    formattime()
    Description
    Converts the time in the number of seconds since the epoch (00:00:00, January 1, 1970) into the time in a specified format
    FORMAT is composed of at least one format element. Percent sign (%) is added before the format element.
    If a format element does not include the percent sign (%) before the letter, it is not converted and returned as a string.
    FORMAT is specified by the following format element.
    %a: Abbreviated name (e.g. Mon, Sun) of the day of the week
    %A: Full name of the day of the week
    %b: Abbreviated name (e.g. Jun, Sep) of the month of the year
    %B: Full name of the month of the year
    %c: Date and time based on the current locale
    %C: Date and time based on the current locale (Tuesday, March 14, 1995, 12:41:29)
    %d: Day of month (01-31)
    %#d: Day of month (1-31: 0 in the 1st position from the left is removed)
    %H: Hour of day (00-23)
    %#H: Hour of day (0-23: 0 in the 1st position from the left is removed)
    %I: Hour of day (01-12)
    %#I: Hour of day (1-12: 0 in the 1st position from the left is removed)
    %j: Day of year (001-366)
    %#j: Day of year (1-366: 0 in the positions from the left is removed)
    %m: Month (01-12)
    %#m: Month (1-12: 0 in the position from the left is removed)
    %M: Minute (00-59)
    %#M: Minute (0-59: 0 in the position from the left is removed)
    %p: AM or PM based on locale
    %S: Second (00-59)
    %#S: Second (0-59: 0 in the position from the left is removed)
    %U: Week of year (00-51: Sunday is the first day of the week)
    %#U: Week of year (0-51: Sunday is the first day of the week, 0 in the position from the left is removed)
    %w: Day of week (0-6: Sunday is 0)
    %#w: Day of week (0-6: Sunday is 0, 0 in the position from the left is removed)
    %W: Week of year (00-51: Monday is the first day of the week)
    %#W: Week of year (0-51: Monday is the first day of the week, 0 in the position from the left is removed)
    %x: Date based on the current locale
    %#x: Date based on the current locale (Tuesday, March 14, 1995)
    %X: Time based on the current locale
    %y: Last two digits of the year (00-99)
    %#y: Last two digits of the year (00-99: 0 in the 2nd digit removed)
    %Y: A complete 4-digit year
    %#Y: A complete 4-digit year (0 in the first digit is removed)
    %z(%Z): Name of time zone. %z should be left blank if time zone is not specified.
    %%: Percent sign (%)
    Syntax
    ret = formattime(sec,format)
    Parameters
    sec:Time elapsed from 0:00, January 1, 1970 (seconds)
    format:Format
    Return Value
    string:Conversion result
    NULL:Error or conversion result
    System Return Value
    ERROR
    0Success
    1Argument error
    Example
    //[result example]
    //
    // * 4 digit year number                      [%Y ] : 2004
    //   ・
    //   ・
    //   ・
    // * date and time                            [%C ] : Fri Jan 23 16:56:15 JST 2004
    // * date and time                            [%c ] : Fri Jan 23 16:56:15 2004
    // * date (name base)                         [%#x] : %#x
    // * date (number base)                       [%x ] : 01/23/04
    // * time                                     [%X ] : 16:56:15
    // * AM/PM                                    [%p ] : PM
    // * time zone                                [%z ] : %z
    // * same as %z                               [%Z ] : JST
    // * persent sign                             [%% ] : %
    //
    
    exit getFormatTime()
    
    function getFormatTime()
    
    	local b_time, f_time, msg, opt, i
    	local aFormat = { /* [0]: format, [1]: description */\
    					  { '%Y',  '4 digit year number' } \
    					, { '%#Y', 'same as %Y' } \
    					, { '%y',  'last 2 digit year number (00-99)' } \
    					, { '%#y', 'last 2 digit year number ( 0-99)' } \
    					, { '%m',  'month number (01-12)' } \
    					, { '%#m', 'month number ( 1-12)' } \
    					, { '%B',  'complete month name' } \
    					, { '%b',  '3 letter month name' } \
    					, { '%U',  'week of the year (Sunday is first (00-51)' } \
    					, { '%#U', 'week of the year (Sunday is first ( 0-51)' } \
    					, { '%W',  'week of the year (Monday is first (00-51)' } \
    					, { '%#W', 'week of the year (Monday is first ( 0-51)' } \
    					, { '%A',  'complete day of the week name' } \
    					, { '%a',  '3 letter day of the week name' } \
    					, { '%w',  'day of the week number (0-6)' } \
    					, { '%#w', 'same as %w' } \
    					, { '%d',  'day number (01-31)' } \
    					, { '%#d', 'day number ( 1-31)' } \
    					, { '%H',  'hour (00-23)' } \
    					, { '%#H', 'hour ( 0-23)' } \
    					, { '%I',  'hour (01-12)' } \
    					, { '%#I', 'hour ( 1-12)' } \
    					, { '%M',  'minute (00-59)' } \
    					, { '%#M', 'minute ( 0-59)' } \
    					, { '%S',  'second (00-59)' } \
    					, { '%#S', 'second ( 0-59)' } \
    					, { '%j',  'day of the year (001-366)' } \
    					, { '%#j', 'day of the year (  1-366)' } \
    					, { '%C',  'date and time' } \
    					, { '%c',  'date and time' } \
    					, { '%#x', 'date (name base)' } \
    					, { '%x',  'date (number base)' } \
    					, { '%X',  'time' } \
    					, { '%p',  'AM/PM' } \
    					, { '%z',  'time zone' } \
    					, { '%Z',  'same as %z' } \
    					, { '%%',  'persent sign' } \
    					}
    
    	b_time = curtime()
    
    	loop i=0; i<count(aFormat); i++
    		msg = rpad(aFormat[i][1], 40)
    		opt = rpad(aFormat[i][0], 3)
    		f_time = formattime(b_time, aFormat[i][0])
    		print('* ' & msg & ' [' & opt & '] : ' & f_time, stdout)
    	endloop
    
    endfunction
    
    Topへ
    strdate()
    Description
    Returns Dates in YYYYMMDD format after converting the given time in the number of seconds since the epoch (00:00:00, January 1, 1970)
    Syntax
    ret = strdate(sec)
    Parameters
    sec:Time elapsed from 0:00, January 1, 1970 (seconds)
    Return Value
    string:Date in YYYYMMDD
    NULL:Error
    System Return Value
    ERROR
    0Success
    1Argument error
    Example
    Topへ
    strtime()
    Description
    Returns Time in HHMMSS format after converting the given time in the number of seconds since the epoch (00:00:00, January 1, 1970)
    Syntax
    ret = strtime(sec)
    Parameters
    sec:Time elapsed from 0:00, January 1, 1970 (seconds)
    Return Value
    string:Time in HHMMSS
    NULL:Error
    System Return Value
    ERROR
    0Success
    1Argument error
    Example
    Topへ

    © Insight Technology, Inc. 1996-2003 All Rights Reserved.