/* * $Id$ */ /* * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * * Copyright 2000 Luiz Rafael Culik * Documentation for: CDOW(),CMONTH(),DATE(),CTOD(),DAY(),DAYS() * DOW(),DTOS(),DTOC(),ELAPTIME(),MONTH(),SECONDS(),SECS(),TIME(),YEAR() * See doc/license.txt for licensing terms. * */ /* $DOC$ * $FUNCNAME$ * CDOW() * $CATEGORY$ * Date * $ONELINER$ * Converts a date to the day of week * $SYNTAX$ * CDOW() --> cDay * $ARGUMENTS$ * Any date expression. * $RETURNS$ * The current day of week. * $DESCRIPTION$ * This function returns a character string of the day of the week, * from a date expression passed to it. * If a NULL date is passed to the function, the value of the function * will be a NULL byte. * $EXAMPLES$ * ? CDOW(DATE()) * if CDOW(DATE()+10) =="SUNDAY" * ? "This is a sunny day." * Endif * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant. * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * DAY(),DOW(),DATE(),CMONTH() * $END$ */ /* $DOC$ * $FUNCNAME$ * CMONTH() * $CATEGORY$ * Date * $ONELINER$ * Return the name of the month. * $SYNTAX$ * CMONTH() --> cMonth * $ARGUMENTS$ * Any date expression. * $RETURNS$ * The current month name * $DESCRIPTION$ * This function returns the name of the month (January,February,etc.) * from a date expression passed to it. * If a NULL date is passed to the function, the value of the function * will be a NULL byte. * $EXAMPLES$ * ? CMONTH(DATE()) * if CMONTH(DATE()+10) =="March" * ? "Have you done your system BACKUP?" * Endif * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * CDOW(),DATE(),MONTH(),YEAR(),DOW(),DTOC() * $END$ */ /* $DOC$ * $FUNCNAME$ * DATE() * $CATEGORY$ * Date * $ONELINER$ * Return the Current OS Date * $SYNTAX$ * DATE() --> dCurDate * $ARGUMENTS$ * None * $RETURNS$ * Current system date. * $DESCRIPTION$ * This function returns the current system date. * $EXAMPLES$ * ? Date() * $TESTS$ * ? "Today is ",Day(date())," of ",cMonth(date())," of ",Year(date()) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper Compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * CTOD(),DTOS(),DTOC(),DAY(),MONTH(),CMONTH() * $END$ */ /* $DOC$ * $FUNCNAME$ * CTOD() * $CATEGORY$ * Date * $ONELINER$ * Converts a character string to a date expression * $SYNTAX$ * CTOD() --> dDate * $ARGUMENTS$ * A character date in format 'mm/dd/yy' * $RETURNS$ * A date expression * $DESCRIPTION$ * This function converts a date that has been entered as a character * expression to a date expression.The character expression will be in * the form "MM/DD/YY" (based on the default value in SET DATE) or in * the appropriate format specified by the SET DATE TO command. If an * improper character string is passed to the function,an empty date * value will be returned. * $EXAMPLES$ * ? CTOD('12/21/00') * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * SET DATE,DATE(),DTOS() * $END$ */ /* $DOC$ * $FUNCNAME$ * DAY() * $CATEGORY$ * Date * $ONELINER$ * Return the numeric day of the month. * $SYNTAX$ * DAY() --> nMonth * $ARGUMENTS$ * Any valid date expression. * $RETURNS$ * Numeric value of the day of month. * $DESCRIPTION$ * This function returns the numeric value of the day of month from a * date. * $EXAMPLES$ * ? Day(DATE()) * ? Day(DATE()+6325) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * CTOD(),DTOS(),DTOC(),DATE(),MONTH(),CMONTH() * $END$ */ /* $DOC$ * $FUNCNAME$ * DAYS() * $CATEGORY$ * Date * $ONELINER$ * Convert elapsed seconds into days * $SYNTAX$ * DAYS( ) --> nDay * $ARGUMENTS$ * The number of seconds * $RETURNS$ * The number of days * $DESCRIPTION$ * This function converts seconds to the equivalent number * of days; 86399 seconds represents one day, 0 seconds being midnight. * $EXAMPLES$ * ? DAYS(2434234) * ? "Has been passed ",DAYS(63251),' since midnight' * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * SECONDS(),SECS(),ELAPTIME() * $END$ */ /* $DOC$ * $FUNCNAME$ * DOW() * $CATEGORY$ * Date * $ONELINER$ * Value for the day of week. * $SYNTAX$ * DOW() --> nDay * $ARGUMENTS$ * Any valid date expression * $RETURNS$ * The current day number * $DESCRIPTION$ * This function returns the number representing the day of the week * for the date expressed as . * $EXAMPLES$ * ? DOW(DATE()) * ? DOW(DATE()-6584) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * DTOC(),CDOW(),DATE(),DTOS(),DAY() * $END$ */ /* $DOC$ * $FUNCNAME$ * DTOC() * $CATEGORY$ * Date * $ONELINER$ * Date to character conversion * $SYNTAX$ * DTOC() --> cDate * $ARGUMENTS$ * Any date * $RETURNS$ * Character represention of date * $DESCRIPTION$ * This function converts any date expression (a field or variable) * expressed as to a character expression in the default * format "MM/DD/YY". The date format expressed by this function is * controled in part by the date format specified in the SET DATE * command * $EXAMPLES$ * ? DTOC(Date()) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * SET DATE,DATE(),DTOS() * $END$ */ /* $DOC$ * $FUNCNAME$ * DTOS() * $CATEGORY$ * Date * $ONELINER$ * Date to string conversion * $SYNTAX$ * DTOS() --> cDate * $ARGUMENTS$ * Any date * $RETURNS$ * String notation of the date * $DESCRIPTION$ * This function returns the value of as a character * string in the format of YYYYMMDD. If the value of is * an empty date, this function will return eight blank spaces. * $EXAMPLES$ * ? DTOS(Date()) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * DTOC(),DATE(),DTOS() * $END$ */ /* $DOC$ * $FUNCNAME$ * ELAPTIME() * $CATEGORY$ * Time * $ONELINER$ * Calculates elapted time. * $SYNTAX$ * ELAPTIME(,) --> cDiference * $ARGUMENTS$ * Start in time as a string format * End time as a string format * $RETURNS$ * Difference between the times * $DESCRIPTION$ * This function returns a string that shows the difference between * the starting time represented as and the ending time * as . If the stating time is greater then the ending * time, the function will assume that the date changed once. * $EXAMPLES$ * Static cStartTime * Init Proc Startup * cStartTime:=Time() * * Exit Proc StartExit * ? "You used this program by",ELAPTIME(cStartTime,Time()) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * SECS(),SECONDS(),TIME(),DAY() * $END$ */ /* $DOC$ * $FUNCNAME$ * MONTH() * $CATEGORY$ * Date * $ONELINER$ * Converts a date expression to a month value * $SYNTAX$ * MONTH() --> nMonth * $ARGUMENTS$ * Any valid date expression * $RETURNS$ * Corresponding number of the month in the year, ranging from * 0 to 12 * $DESCRIPTION$ * This function returns a number that represents the month of a given * date expression . If a NULL date (CTOD('')) is passed to the * function, the value of the function will be 0. * $EXAMPLES$ * ? Month(DATE()) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * CDOW(),DOW(),YEAR(),CMONTH() * $END$ */ /* $DOC$ * $FUNCNAME$ * SECONDS() * $CATEGORY$ * Time * $ONELINER$ * Returns the number of elapsed seconds past midnight. * $SYNTAX$ * SECONDS() --> nSeconds * $ARGUMENTS$ * None * $RETURNS$ * Number of seconds since midnight * $DESCRIPTION$ * This function returns a numeric value representing the number of * elapsed seconds based on the current system time. * The system time is considered to start at 0 (midnight);it continues * up to 86399 seconds.The value of the return expression is displayed * in both seconds and hundredths of seconds. * $EXAMPLES$ * ? Seconds() * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * TIME() * $END$ */ /* $DOC$ * $FUNCNAME$ * SECS() * $CATEGORY$ * Time * $ONELINER$ * Return the number of seconds from the system date. * $SYNTAX$ * SECS( ) --> nSeconds * $ARGUMENTS$ * Character expression in a time string format * $RETURNS$ * Number of seconds * $DESCRIPTION$ * This function returns a numeric value that is a number of elapsed * seconds from midnight based on a time string given as . * $EXAMPLES$ * ? Secs(Time()) * ? Secs(time()-10) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * SECONDS(),ELAPTIME(),TIME() * $END$ */ /* $DOC$ * $FUNCNAME$ * TIME() * $CATEGORY$ * Time * $ONELINER$ * Returns the system time as a string * $SYNTAX$ * TIME() --> cTime * $ARGUMENTS$ * None * $RETURNS$ * Character string representing time * $DESCRIPTION$ * This function returns the system time represented as a character * expression in the format of HH:MM:SS * $EXAMPLES$ * ? Time() * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * DATE(),SECONDS() * $END$ */ /* $DOC$ * $FUNCNAME$ * YEAR() * $CATEGORY$ * Date * $ONELINER$ * Converts the year portion of a date into a numeric value * $SYNTAX$ * YEAR() --> nYear * $ARGUMENTS$ * Any valid date expression * $RETURNS$ * The year portion of the date. * $DESCRIPTION$ * This function returns the numeric value for the year in . * This value will always be a four-digit number and is not affected * by the setting of the SET CENTURY and SET DATE commands. Addition * ally, an empty date expression passed to this function will yield * a zero value. * * $EXAMPLES$ * ? Year(date()) * ? year(CTOD("01/25/3251")) * $STATUS$ * R * $COMPLIANCE$ * This function is Ca-Clipper compliant * $PLATFORMS$ * All * $FILES$ * Library is rtl * $SEEALSO$ * DAY(),MONTH() * $END$ */