Skip Navigation

[Resolved] Retrieve date from date field

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 3 voices.

Last updated by PiotrO586 7 years ago.

Assisted by: Beda.

Author
Posts
#582741

Hi,

how to retrieve date string from a date custom field?
I was trying something like:
date('Y-m-d', strtotime($_POST[ 'wpcf' ][ 'event-date-and-time' ]))
to set up post title, but I end up with date 1970-01-01

My WordPress is set to y-m-d date pattern.

Regards

#582902

y.S

To my knowledge, dates are already saved as Unix Timestamp so there is no need for

strtotime()
#582965

Do you mean from a Toolset Types Date Field?
Those Fields store a timestamp in the Database, which looks like a long number.

You can either display it with our ShortCodes (both raw and in human readable format) or by PHP.
In PHP you can retrieve it with a simple get_post_meta() and then covert this to anything you like with the date() function.
hidden link
https://developer.wordpress.org/reference/functions/get_post_meta/

#585113

Thanks!

The forum ‘Types Community Support’ is closed to new topics and replies.