The professional tool to automate FTP and secure FTP transfers. Automated FTP & Batch FTP |
Get the current date and time
Syntax: GETTIME(format)
| FORMAT0 | YYYY_MM_DD-hh_mm_ss |
| FORMAT1 | DD_MM_YYYY-hh_mm |
| FORMAT2 | YYYY_MM_DD-hh_mm |
| FORMAT3 | YYYYMMDD |
| FORMAT4 | hhmm |
| YEAR | Current year in four digits format. |
| MONTH | Current month. |
| DAY | Current day. |
| HOUR | Current hour. |
| MIN | Current minute. |
| SEC | Current second. |
| WEEKDAY | Current day of week. Possible values are Sun, Mon, Tue, Wed, Thu, Fri or Sat |
(hh: Hour, mm: Minute, DD: Day, MM: Month, YYYY: Year ) |
|
Return value:
The requested date data.
Remarks:
Command History:
YEAR, MONTH, DAY, HOUR, MIN, SEC and WEEKDAY formats were added in ScriptFTP v2.2 Build 4th April 2006.
Examples:
# Print the current date in different formats:
PRINT(GETTIME(FORMAT1))
PRINT(GETTIME(FORMAT2))
PRINT(GETTIME(FORMAT3))
PRINT(GETTIME(FORMAT4))
# FORMAT1 is used by default:
PRINT(GETTIME)
# Get the current date
$date=GETTIME()
# Concatenate "BACKUP", the current date and ".txt" to build the log file name
$logfile="C:\BACKUP_LOGS\BACKUP-".$date.".txt"
# Start logging
LOGTO($logfile)
OPENHOST("ftp.host.com","myuser","mypassword")
PUTFILE("C:\PICS\*.jpg")
CLOSEHOST
# Use GETTIME and CONCAT to build custom
# date formats
$mymonth=GETTIME(MONTH)
$myyear=GETTIME(YEAR)
# Concatenate text
$mydate=$mymonth."-".$myyear
PRINT($mydate)
# Shorter way:
PRINT(GETTIME(MONTH)."-".GETTIME(YEAR))