• Resolved webvd

    (@webvd)


    Hi,

    I’m using your plugin for import and it works great except one thing.

    I have one field which is {pick_up_time[1]} and which has the value: 31/10/2020 19:24
    Now i need it to be outputted as a different date and time format, date only, and time only.

    I’m using the following inline php codes:

    [date( "Y-d-m H:i:s", strtotime( {pick_up_time[1]} ) )]
    [date( "Y-d-m", strtotime( {pick_up_time[1]} ) )]
    [date( "H:i", strtotime( {pick_up_time[1]} ) )]

    But for some reason the output is always 1970-01-01 00:00:00, 1970-01-01 or 00:00.

    For example:

    31/10/2020 19:24

    should become:

    2020-10-31 19:24:00
    2020-10-31
    19:24

Viewing 1 replies (of 1 total)
  • Thread Starter webvd

    (@webvd)

    Solved my own question, had to replace the / string in strtotime…

    Use:

    [date( "Y-m-d H:i:s", strtotime( str_replace("/",".",{pick_up_time[1]}) ) )]
    [date( "Y-m-d", strtotime( str_replace("/",".",{pick_up_time[1]}) ) )]
    [date( "H:i:s", strtotime( str_replace("/",".",{pick_up_time[1]}) ) )]
    • This reply was modified 4 years, 5 months ago by webvd.
Viewing 1 replies (of 1 total)
  • The topic ‘Strtotime outputs 1970-01-01 00:00:00 instead of correct date’ is closed to new replies.