Jump to content

Recommended Posts

Posted

Hello everyone.

I have a question that i can't find a way to solve.

I have following function in _uikit.php 

$date = $page->get('date|createdStr');
$dateModified = $page->get('datemodified');

But I need to output the $date in to different formats.

My further function looks like this

// return the blog post article markup
	return "
		<div>
			<article class='uk-article blog-post $class'>
				<meta property='name' content='$page->title'>
				<meta property='author' typeof='Person' content='Arra Lifte Harmanschlag'>
				<meta property='dateModified' content='$dateModified'>
				<meta property='datePublished' content='$date'>
				<meta class='uk-margin-remove-adjacent' property='articleSection' content='News'>
				<div property='image' typeof='ImageObject'>
					$featuredBlogPostImage
				</div>
				$heading
				<ul class='mt25 uk-margin-remove-bottom uk-subnav uk-subnav-divider'>
					<li class='uk-article-meta'>
						<time datetime='$date'>$byline</time>
					</li>
				</ul>
				<div class='mt25' property='text'>
					$body
				</div>
			</article>
		</div>
	";	

Now I need to output the meta property in this format 2019-03-02CET05:23:00 and then a normal date format that is displayed on the Homepage with 2. März 2019 without time.

Can anybody help me?

Thanks in advance.

Posted

You may try getUnformatted, something like this:

$dateModified = date('d/m/Y', $page->getUnformatted('datemodified'));

(adjust the d/m/Y to whatever required)

  • Like 2

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
×
×
  • Create New...