Local Test Cases:
# there can be no spaces on either side of the equal sign, before the error has been out here
yesterday= ' date-d last-day +%y-%m-%d '
echo $yesterday
curday= ' Date +%y-%m-%d '
echo $curday
echo "Now time: ' Date ' +%y%m%d%T '"
PHPdate format a local time/date. Date (PHP4, PHP5) date format a local time/date description stringdate (string $ format [, int $ timestamp]) returns the string date generated by the integer timestamp according to the given format string
(PHP 4,
1. Cause of Error:The date type cannot contain precision after seconds.As Date: 2010-01-01 20:02:20.0Workaround: Remove the precision after the date seconds, To_date (substr (invoice_date,1,10), ' Yyyy-mm-dd ')If Date: 2010-01-01 20:02:202. INSERT
1. Error Reason:The date type cannot contain the precision after the second.As Date: 2010-01-01 20:02:20.0
Workaround: Remove the precision after the date secondsAs a date: 2010-01-01 20:02:20
2, INSERT into TEST2 (C1, C2,C3) VALUES
Date
(PHP 4, PHP 5)
date-formatting a local time/date
DescriptionString Date (string $format [, int $timestamp])
Returns a string that is the result of the timestamp of an integer in a given format string. If no timestamp is given, the local current
Date
(PHP 4, PHP 5)
Date-format a local time/dateDescription: string date (string $ format [, int $ timestamp])
Returns the string generated by the integer timestamp according to the given format string. If no timestamp is provided, the current
format character
Description
return Value Example
Day
---
---
D
The first day of the month with a leading zero of 2 digits
01 to 31
J
Days of the month, no leading zeros
1 to 3
Share the Control List of PHP time formats. The format character specifies the return value. for example, the day in the month ------ d, the number of the day in the month contains the 2nd digit of the leading zero, 01 to 31j, and no leading zero, 1
format character
Description
example of return value
Day
---
---
D
The day ordinal of a month with a leading zero 2-digit number
01 to 31
J
The day ordinal of the month without
Copy Code code as follows:
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan
* MIT License
*
* Includes Enhancements by Scott Trenda
* and Kris Kowal
*
* Accepts a date, a mask, or a date and a mask.
* Returns A formatted version
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.