Search results
1 sty 2000 · For examples of what strings strtotime() can take, see the man page: php.net/manual/en/function.strtotime.php. For examples on reformatting dates using date() like in Dan Grossman's example, see us.php.net/manual/en/function.date.php .
9 sty 2024 · If working with SQL databases, you might retrieve a date-time in the SQL format. PHP can handle this format easily: $sqlDateTime = '2023-03-15 08:30:00'; $dateTime = new DateTime($sqlDateTime); $date = $dateTime->format('Y-m-d'); This precisely trims the time part off, leaving you with a clean date. Working with Current Time
9 sie 2023 · You have to use the following code to remove the time portion from the date: This uses days (dd) to create a new date with zero hours, in other words, midnight. To strip the time portion away completely, use the following CONVERT function: Unlike CAST, CONVERT allows you to specify a date format. Here we use 112.
20 mar 2004 · In my PHP script, I want to add a date to a column (of type datetime) in MS SQL Server. I set up the connection following this blog post (php5-sybase, php5-odbc, freetds on Ubuntu 14.04/15.10): https://blog.thesysadmins.co.uk/ubuntu-server-connect-to-mssql-via-php.html.
13 lis 2023 · SQL Server provides a number of options you can use for formatting a date/time string in SQL queries and stored procedures either from an input file (Excel, CSV, etc.) or a date column (datetime, datetime2, smalldatetime, etc.) from a table.
In this SQL Server example, first, we are going to declare a DateTime variable and also use the GETDATE() function. Next, we are going to use the CONVERT, CAST , DATEADD , and DATEPART functions to extract the date part only from a SQL server Datetime Datatype .
15 mar 2013 · The date_format() function returns a date formatted according to the specified format. Note: This function does not use locales (all output is in English). Tip: Also look at the date() function, which formats a local date/time.