Jump to content

How to set date field through API?


Lars282
 Share

Recommended Posts

Hey!

How do I set the date field when adding pages through the API? It defaults to today's date when using the admin, and I want to achieve the same when uploading through the API.

Thanks,

Lars

Link to comment
Share on other sites

You can do it like this to set it to today's date/time:

$page->date = time(); 

Or like this to set a specific date/time, you can use any format that PHP's strtotime() function accepts, like this:

$page->date = "2012-06-25 11:36:00"; 
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...