logo
Tags down

shadow

Yii2 Masked Input datetime, dd-mm-yyyy hh:mm


By : KGidorahh
Date : October 16 2020, 08:10 PM
this one helps. You need to use the alias along with the placeholder and separator option for the clientOptions like below
code :
<?php echo

    $form->field(
        $modelIsoTanksDeliveryOrder, "open_stack", [
            'template' => '{input}{error}{hint}'
        ]
    )->widget(
        \yii\widgets\MaskedInput::class, [
            'mask' => "1-2-y h:s",
            'clientOptions' => [
                'alias' => 'datetime',
                "placeholder" => "dd-mm-yyyy hh:mm",
                "separator" => "-"
            ]
        ]
    );

?>


Share : facebook icon twitter icon

Converting dd/MM/yyyy input to yyyy-MM-dd in date format not varchar/datetime


By : JellyFish
Date : March 29 2020, 07:55 AM
seems to work fine
Main objective is to convert a dd/MM/yyyy to yyyy-MM-dd "date" format to fit in SQL
code :
DateTime date = DateTime.ParseExact(text, "dd/MM/yyyy",
                                    CultureInfo.InvariantCulture);

Yii2: validate masked input


By : Antonio J Rivas Mele
Date : March 29 2020, 07:55 AM
Hope that helps MaskedInput will only generate a text field. I presume that your phone field is being stored as an integer. You'll have to change your validation of the phone field to be text, rather than integer. You may need to change the field type in your database to be varchar(14)

How to use masked input or dropdownlist in yii2 katrik gridview?


By : arthur chang
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have a masked input like this: , You can use MaskedInput widget for example in the "filter" context
code :
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'pjax' => true,
'columns' => [
    ['class' => 'yii\grid\SerialColumn'],
    [
        'attribute' => 'ip',
        'filter'=> MaskedInput::widget([
            'name'=>'MyFilterModelName[ip]',
            'clientOptions' => [
                 'alias' => 'ip',
             ],
        ]);
    ],    
    'objectID',
    'ownerID',
    'subnetID',

    ['class' => 'yii\grid\ActionColumn'],
],
<?=    GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'pjax' => true,
'columns' => [
    ['class' => 'yii\grid\SerialColumn'],
    [
        'attribute' => 'ip',
        'value' => function($model) {
             return MaskedInput::widget([
                'name'          => 'ip_' . $model->id,
                'value'         => $model->ip,

                'clientOptions' => [
                     'alias' => 'ip',
                ],
            ])
        },
    ],    
    'objectID',
    'ownerID',
    'subnetID',
    ['class' => 'yii\grid\ActionColumn'],
],

Pandas Datetime format conversion error yyyy-mm-dd to yyyy-mm or yyyy/mm as a string


By : user3017361
Date : March 29 2020, 07:55 AM
Hope this helps try using pd.to_datetime() and to_period and strftime to change the format of date
code :
df = pd.DataFrame(
    {
        "Collection_End_Date": ["2019-01-07 12:00:00", "2019-01-07 12:00:00", "2019-02-08 12:00:00", "2019-01-05 12:00:00", "2019-01-05 12:00:00"]
    }
)

df['Collection_End_Date'] = pd.to_datetime(df['Collection_End_Date'])
df['month_year'] = df['Collection_End_Date'].dt.to_period('M')
    Collection_End_Date month_year
0   2019-01-07 12:00:00   2019-01
1   2019-01-07 12:00:00   2019-01
2   2019-02-08 12:00:00   2019-02
3   2019-01-05 12:00:00   2019-01
4   2019-01-05 12:00:00   2019-01
df["Collection_End_Date"] = pd.to_datetime(df["Collection_End_Date"])
df['month_year'] = df['Collection_End_Date'].dt.to_period('M')
df['month_year'] = df['month_year'].dt.strftime('%Y/%m')
    Collection_End_Date  month_year
0   2019-01-07 12:00:00    2019/01
1   2019-01-07 12:00:00    2019/01
2   2019-02-08 12:00:00    2019/02
3   2019-01-05 12:00:00    2019/01
4   2019-01-05 12:00:00    2019/01

jQuery masked input - format date as m/d/yyyy or m/dd/yyyy or mm/dd/yyyy or mm/d/yyyy


By : kell
Date : March 29 2020, 07:55 AM
hope this fix your issue I had a similar requirement recently, and the only thing I could find that didn't require me to do a lot of work on tweaking the plugin was to use this modified date masking plugin that is based on the one you mentioned. It seems to be doing the job so far.
If you want to test it out, head to this page.
shadow
Privacy Policy - Terms - Contact Us © voile276.org