我想在我的粉碎数据库中添加一个日期,但我只字不提正确的格式,而纸面上的帮助并不真正帮助。
我的日期是用 d式格式写成的。 因此遗漏了零铅。
我怎么能正确插入这一句子,是否有增加铅零的功能(要么是纸面或文件箱)?
我想在我的粉碎数据库中添加一个日期,但我只字不提正确的格式,而纸面上的帮助并不真正帮助。
我的日期是用 d式格式写成的。 因此遗漏了零铅。
我怎么能正确插入这一句子,是否有增加铅零的功能(要么是纸面或文件箱)?
INSERT INTO TheTable (the_date) VALUES ( yyyy-mm-dd )
这是Kall的正确命令。
$psql_str = date( yyyy-mm-dd , date_parse_from_format( d-m-yyyy , $date_str));
将<代码> 日期_str改为计算格式。
如你看到,产出日期适当加上了主要的零。to_date(text, text)
> function (
SELECT to_date( 1-9-2011 , DD-MM-YYYY );
to_date
------------
2011-09-01
(1 row)
最好的做法是,以明确格式插入日期,因为无论服务器有何种环境,这一日期都保证始终有效。 建议的形式是YYY-MM-DD。 您可以将日期改为这一形式,并履行这一职能:
function convertDate($old) {
$date = explode( - , $old);
if (strlen($date[0]) == 1)
$date[0] = 0 . $date[0];
if (strlen($date[1]) == 1)
$date[1] = 0 . $date[1];
$new = date[2] . - . $date[1] . - . $date[0];
return $new;
}
实际上,如果你证实向德国马克(或更好,“ISO,DMY”确定日期,那么你就不必做
postgres=# create table test_table (date_field date);
CREATE TABLE
postgres=# show DateStyle;
DateStyle
-----------
ISO, MDY
(1 row)
postgres=# set DateStyle= ISO, DMY ;
SET
postgres=# insert into test_table (date_field) values ( 2-4-2011 );
INSERT 0 1
postgres=# select * from test_table;
date_field
------------
2011-04-02
(1 row)
我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。
On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...
I ll take the simplest of the SQL functions as an example: CREATE OR REPLACE FUNCTION skater_name_match(INTEGER,VARCHAR) RETURNS BOOL AS $$ SELECT $1 IN (SELECT skaters_skater.competitor_ptr_id ...
I m 在当地网络上运行几台机器,在Salgresql8.3处撰写一份申请。
I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.
Hey, I have 2 tables in PostgreSql: 1 - documents: id, title 2 - updates: id, document_id, date and some data: documents: | 1 | Test Title | updates: | 1 | 1 | 2006-01-01 | | 2 | 1 | 2007-01-01 |...
I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...
I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...