Macro sc_date

Macro sc_date


 

Scriptcase provides a very useful macro for manipulating dates, which is a very laborious process, however with the use of the sc_date macro (Increments and Decrement Dates), it is much simpler, example:
 
sc_date (Date, format, operator, D, M, A)
 

date - Date field containing the date to be modified
format - Formatting in which the date field is
operator - "" for increment and "-" for decrement
D - Number of days to increase or decrease
M - Number of months to increase or decrease
A - Number of years to increase or decrease

E.g.1:

{datanasc} = sc_data ({datanasc}, "dd/mm/aaaa", " ", 30, 0, 0);

E.g.2:

$nova_data = sc_data ({datanasc}, "aaaa-mm-dd", "-", 15, 3, 2);

E.g.3:

{dt_inclusao} = sc_data (date('Ymd'), "aaaammdd", "-", 0, 1, 1);

Tip:

To make sure the date format, before using the function, put a command in its formula:
echo "form_data =". {date field name};

Run the application and see the correct format.


    • Related Articles

    • Using the macro sc_date_dif_2

      To calculate the difference between two dates we have the macro sc_date_dif_2, in this example we will see how it works and how to use it. 1. The format with which you are keeping within the database must be taken into account: Database Format Macro ...
    • Macro sc_block_display

      In this example, we will see how to use the sc_block_display macro in an Ajax event using a Radio button on a Form, this macro is intended to hide or show a block. The steps in this example: Configuring Radio type field Configuring and creating ...
    • Macro sc_error_continue

      When we want to insert, modify or delete a record within our form it can not be possible because of the database errors that are previously configured, which can be generated by ourselves by means of triggers, for example: In this example we create a ...
    • Using the sc_confirm macro

      In this article, see a practical example of using the sc_confirm macro. This macro can only be used on PHP buttons created in the toolbar of form and control applications, with the aim of confirming the action's excursion. See how to create a PHP ...
    • Using the sc_field_display macro

      To dynamically hide a field in this example, the macro sc_field_display is used, which is responsible for hiding or dynamically displaying a field or several. This macro has scope in the following events: In this example, it will be used within an ...