Jump to content

Working with Dates and Times


Recommended Posts

Hi everyone!

Prolly this is the most noobest question.

But how do you work on date times in Processwire templates?

I've been working on one that will check if it's the current day and not over a certain time.

PHP wise it's easy. But on a Processwire template, it spits out as an error.

$wholedatetime = DateTime("now", new DateTimeZone('Asia/Singapore') );
$currentdate =  $wholedatetime->format('Y/m/d');
$currenttime =  $wholedatetime->format('H');
	echo $page->batchdate;
if ($currentdate != $page->batchdate) {
	if ($currenttime < 23) {	
		$formflag = 2;


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

  • Recently Browsing   0 members

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