Dave's Brain

Browse - Programming Tips - php: How can I get the current date as a string?

Date: 2017nov25
Language: php

Q.  php: How can I get the current date as a string?

A.  Use the date() function:

<?php print date('Y-m-d'); // eg 2020-12-31 print strtolower(date('YMd')); // eg 2020dec31 ?>

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.