gsqlcmd Functions

gsqlcmd Functions

Functions allow populating parameter values defined in the /set and /add options.

For example, you can download historical prices from Yahoo Finance or MSN Money into files like AAPL.json or FB.json, i.e., the file names contain stock symbols.

So, you can add a symbol and loaded time to output data using functions like

gsqlcmd convert src\*.JSON csv\*.CSV /add=Symbol=FileNameWithoutExtension();LoadDate=FileDateTime()

Several functions use the NYSE trade time. This time is an actual EST time during NYSE trade hours, 9:30 AM - 4:00 PM, and the EST 4:00 PM of the last trading date after hours.

Several functions use the time parsed from file names. You can create such time parts using the stamp mode.

The FileText() function (without the file name) returns the current input file or web request content.
You can use it to save the content in a database using the /set option. For example: /set=content=FileText()

List of Functions

FunctionMeaning
UtcNow()Current UTC date and time
UtcDateTime()Current UTC date and time
UtcDate()Current UTC date
UtcTime()Current UTC time
Now()Current date and time
DateTime()Current date and time
Date()Current date
Time()Current time
NyseDateTime()NYSE trade date and time
NyseDate()NYSE trade date
NyseTime()NYSE trade time
FileDateTime([<File>])File date and time
FileDateTimeUtc([<File>])File UTC date and time
FileDateTimeNyse([<File>])File date and time as NYSE trade date and time
FileDate([<File>])File date
FileDateUtc([<File>])File UTC date
FileDateNyse([<File>])File date as NYSE trade date
FileTime([<File>])File time
FileTimeUtc([<File>])File UTC time
FileTimeNyse([<File>])File time as NYSE trade time
FileName([<File>])File name
FileNameOnly([<File>])File name without extension
FileNameWithoutExtension([<File>])File name without extension
FileNameWithoutPage([<File>])Input file name without extension and page
FilePage([<File>])Input file page (2 for "AAPL-02.htm")
FileText([<File>])File text
FileNameDateTime(<File>)Date and time parsed from an input file name *
FileNameDate(<File>)Date parsed from an input file name *
FileNameTime(<File>)Time parsed from an input file name *

* Supported formats for dates and times in file names:

The value after the first hyphenThe value at the name end
*-yyyyMMddHHmmss*.**yyyyMMddHHmmss.*
*-yyyyMMdd-HHmmss*.**yyyyMMdd-HHmmss.*
*-yyyyMMddTHHmmss*.**yyyyMMddTHHmmss.*
*-yyyy-MM-dd*.**yyyy-MM-dd.*
*-yyyyMMdd*.**yyyyMMdd.*
*-HHmmss*.**HHmmss.*