SYNTAX |
DateTimeConvert( format, date, time = Null ) |
RETURNS |
NUMBER or ARRAY |
FUNCTION |
The function allows to convert from DateTime format to DateNum and TimeNum and vice versa.
format parameter controls the direction of conversion:
-
format = 0 - converts DateTime format to DateNum format, example
mydatenum = DateTimeConvert( 0, DateTime() );// - this returns DateNum
date argument should be in datetime formattime argument in this case should not be used
- format = 1 - converts DateTime format to TimeNum format, example:
mytimenum = DateTimeConvert( 1, DateTime() ); // - returns timenum
date argument should be in datetime formattime argument in this case should not be used
-
format = 2 - converts from DateNum and optionally TimeNum to DateTime format, example:
mydatetime = DateTimeConvert( 2, DateNum(), TimeNum() );
date argument should be in datenum formattime argument (optional) should be in timenum format. In case of EOD data you can skip time argument:
mydatetime = DateTimeConvert( 2, DateNum() );
-
format = 3 - (AB5.0 or higher) converts DateTime format to Seconds (00..59) example:
myseconds = DateTimeConvert( 3, DateTime() );
date argument should be in datetime, formattime argument in this case should not be used
-
format = 4 - (AB5.0 or higher) converts DateTime format to Minutes(00..59) example:
myminute = DateTimeConvert( 4, DateTime() );
date argument should be in datetime, formattime argument in this case should not be used
-
format = 5 - (AB5.0 or higher) converts DateTime format to Hours (00..23) example:
myhour = DateTimeConvert( 5, DateTime() );
date argument should be in datetime, formattime argument in this case should not be used
|
EXAMPLE |
mydatenum = DateTimeConvert( 0, DateTime()
);// - this returns DateNum
mytimenum = DateTimeConvert( 1, DateTime()
); // - returns timenum
mydatetime = DateTimeConvert( 2, DateNum(), TimeNum()
);
mydatetime = DateTimeConvert( 2, DateNum()
);
|
SEE ALSO |
DateNum() function , DateTime() function , DateTimeToStr() function , Day() function , DayOfWeek() function , DayOfYear() function , TIMENUM() function , MONTH() function , YEAR() function , HOUR() function , MINUTE() function , SECOND() function |