Caravan Business Server>Help>Constants>Special Date and Time Variable |
Syntax
|
The date & time values are stored in a special Time variable. The data type Time in the Caravan database also has the same properties and can be accessed in the same manner as the Time variable. <CARAVAN>time now</CARAVAN>
|
Text
|
now is the time variable The sub components of the time variable are Description | Caravan keyword | Year | Year | Month | Month | Day or DD | Date | Hour | Hour | Minute | Minute | Second | Second | Time | Time Value |
The current date and time in the system can be accessed by declaring the time variable and accessing its sub components. The sub components of the time variable can even be assigned to temporary variables. The sub-components of the variable can be accessed as shown in the example.Use semi colons between sub components following each other. * When a variable is declared within a web page, only Caravan code within that web page can access or change the value of that variable; it has a scope that is local to that web page. * Local variables declared with time remain in existence only as long as the web page is executing.
|
Sample
|
<CARAVAN> time now "TODAY'S DATE IS <br>" now(date);" /";now(month);" /";now(year) "THE TIME IS <br>" now(hour);":"; now(minute) </CARAVAN> The Time variables can be similarly assigned new values and then saved as different date and time. The date and time 04/11/2002 will be assigned to another Caravan time variable (newtime) as shown in the example. <CARAVAN> time now "CURRENT DATE IS <br>" now(date);" /";now(month);" /";now(year) now(year)="2002" now(date)="4" now(month)="11" "CHANGED DATE IS <br>" now(date);" /";now(month);" /";now(year) </CARAVAN>
|
Back
|