cf_created strftime strtotime

assospiz 03 Feb, 2014
Answer
Hi everybody,

In Chronoforms we must enter the date format cf_created in the email and we use
{chronoform_data.cf_created}

After, in Chronoconnectivity, we have to change the date format from cf_created
Y-m-d H: i: s ---->% A% e% B% Y hours H: i

before sending a new email and we use
<? php 
setlocale (LC_TIME, 'it_IT.utf8'); 
$ form-> data ['data_ita'] = strftime ("% A% e% B% Y", strtotime ($ form-> data ['cf_created'])); 
$ form-> data ['ora_ita'] = date ("H: i", strtotime ($ form-> data ['cf_created'])); 
?>

And all works fine.

Now we would like to use the same syntax also in ChronoForms to send also the first email with the date format changed, But it does not work.
You can help?
Thanks
Assospiz
GreyHead 04 Feb, 2014
Hi Assospiz,

I don't see any obvious reason why that code wouldn't work. Do you see anything useful if you add a Debugger action to the form event?

Bob
assospiz 05 Feb, 2014
This is Debugger output
Data Array: 
Array
(
    [option] => com_chronoforms
    [chronoform] => rampigada_santa
    [event] => submit
    [cf_sid] => f6457a744f82e60d49d4b93006a97959
    [Itemid] => 216
    [view] => article
    [id] => 0
    [numero] => 0
    [oggetto] => 3ª RAMPIGADA SANTA 2014 - Concorrente n.94
    [categoria] => MULONI-BABE
    [input_submit_5] => 
    [beb7a5f69e38d82261571d9dc3278f82] => 1
    [_FORM_FILES_] => Array
        (
        )

    [input_submit_1] => 
    [cognome] => TEST
    [nome] => Test
    [sesso] => M
    [citta] => Test
    [provincia] => TT
    [nascita] => 17/04/1980
    [zona] => Trieste (Provincia)
    [rione] => Muggia
    [rioni_provincia] => Muggia
    [altezza] => 111
    [peso] => 111
    [clapa] => Test
    [input_submit_2] => 
    [mail] => spiz@spiz.it
    [phone] => 0123456789
    [documento] => patente
    [documentoN] => TEST1234567890
    [certificato] => NESSUN CERTIFICATO
    [eta] => 34
    [input_submit_3] => 
    [gara_tipo] => CICLISTA
    [input_submit_4] => 
    [chronoform_data] => Array
        (
            [cf_uid] => 3fad07e00afd2538fdca6bc8036fa263
            [cf_created] => 2014-02-05 12:07:57
            [cf_created_by] => 74
            [cf_ipaddress] => 217.169.117.33
            [cf_user_id] => 74
            [option] => com_chronoforms
            [chronoform] => rampigada_santa
            [event] => submit
            [cf_sid] => f6457a744f82e60d49d4b93006a97959
            [Itemid] => 216
            [view] => article
            [id] => 0
            [numero] => 0
            [oggetto] => 
            [categoria] => MULONI-BABE
            [input_submit_5] => 
            [beb7a5f69e38d82261571d9dc3278f82] => 1
            [_FORM_FILES_] => Array
                (
                )

            [input_submit_1] => 
            [cognome] => TEST
            [nome] => Test
            [sesso] => M
            [citta] => Test
            [provincia] => TT
            [nascita] => 17/04/1980
            [zona] => Trieste (Provincia)
            [rione] => Muggia
            [rioni_provincia] => Muggia
            [altezza] => 111
            [peso] => 111
            [clapa] => Test
            [input_submit_2] => 
            [mail] => test@test.it
            [phone] => 0123456789
            [documento] => patente
            [documentoN] => TEST1234567890
            [certificato] => NESSUN CERTIFICATO
            [eta] => 34
            [input_submit_3] => 
            [gara_tipo] => CICLISTA
            [input_submit_4] => 
            [cf_id] => 94
        )

    [chronoform_data_cf_id] => 94
    [fullname] => TEST Test
    [data_ita] => giovedì  1 gennaio 1970
    [ora_ita] => 01:00
)
Validation Errors: 
Array
(
)


This is the problem with the date in "italian style"

    [cf_created] => 2014-02-05 12:07:57
    [data_ita] => giovedì  1 gennaio 1970
    [ora_ita] => 01:00
)

It seems that the data cf_created not be detected and then modified in two variables data_ita and ora_ita that in fact mark Unix time (POSIX time) Coordinated Universal Time (UTC), Thursday, 1 January 1970.
Ideas?
assospiz 05 Feb, 2014
Solved!
The correct syntax is
<?php
setlocale(LC_TIME, 'it_IT.utf8');
$form->data['data_ita'] = strftime("%A %e %B %Y", strtotime($form->data['chronoform_data']['cf_created']));
$form->data['ora_ita'] = date("H:i", strtotime($form->data['chronoform_data']['cf_created']));
?>
assospiz 05 Feb, 2014
Solved!
The correct syntax is
<?php
setlocale(LC_TIME, 'it_IT.utf8');
$form->data['data_ita'] = strftime("%A %e %B %Y", strtotime($form->data['chronoform_data']['cf_created']));
$form->data['ora_ita'] = date("H:i", strtotime($form->data['chronoform_data']['cf_created']));
?>
This topic is locked and no more replies can be posted.