My database is Oracle, and I use navicat to query data.
My code is below:
select
jzmktr.VPRONAME as jzmktrvproname,
jzbid.vproname as jzbidvproname,
jzbid.vprolocus as jzbidvprolocus,
jzcur.vname as jzcurvname,
doc.name as docname,
zspm.def2 as zspmdef2,
oa.name as oaname,
zspm.def6 as zspmdef6,
zspm.def4 as zspmdef4,
zpus.def3 as zpusdef3,
jzbidt.dstartdate as jzbidtdstartdate,
jzbidt.dcompletedate as jzbidtdconpletedate,
zspm.def4 as zspmdef4,
jzcur.PK_GROUP
from JZMKT_REGISTER jzmktr
left join JZCU_REGISTER jzcur
on jzcur.PK_REGISTER = jzmktr.pk_customer
left join JZBID_VENDSTART jzbid
on jzmktr.PK_MKTREGISTER = jzbid.PK_MKTREGISTER
left join jzbid_hitbidlog hit
on hit.pk_vendstart = jzbid.pk_vendstart
left join ZSPM_MAK_EXPLANATION zspm
on zspm.def16 = hit.pk_hitbidlog
left join zspm_pub_uf_singlehead_h zpus
on zpus.def1 = jzmktr.PK_MKTREGISTER
left join JZBID_TENDERCHK jzbidt
on jzbidt.pk_vendstart = jzbid.pk_vendstart
left join bd_defdoc doc
on doc.pk_defdoc = jzbid.pk_operatetype
left join org_adminorg oa
on oa.pk_adminorg = zspm.def5
where jzmktr.dr='0' and jzmktr.FSTATUSFLAG='1'
You can see the snapshot, this is the sql
execute result, the time format of jzbidtdstartdate
and jzbidtdconpletedate
is yyyy-MM-dd HH:mm:ss
:
How can I set the time format to yyyy-MM-dd
?
EDIT
If I change the jzbidtdstartdate
to :
to_char(jzbidt.dstartdate, 'yyyy-MM-dd') as jzbidtdstartdate,
I will get this error:
on doc.pk_defdoc = jzbid.pk_operatetype
left join org_adminorg oa
on oa.pk_adminorg = zspm.def5
where jzmktr.dr='0' and jzmktr.FSTATUSFLAG='1'
--and jzmktr.pk_org in (parameter('param3'))
-- and substr(jzmktr.dbilldate,1,10)>=parameter('param1')
-- and substr(jzmktr.dbilldate,1,10)<=parameter('param2')
[Err] ORA-01722: invalid number
UPDATE
I search the jzbidt.dstartdate
in the database, it is CHAR
type.
In your SQL select clause, change the column from jzbidt.dstartdate
to to_char(jzbidt.dstartdate, 'YYYY-MM-DD')
to get the date in your required format, assuming it is of a date
type.
Since it is of char
type, you only need to do a substring, so substr(jzbidt.dstartdate, 0,10)
will work fine.
如果jzbidt.dstartdate
是CHAR
,则应将char
转换为date
,然后格式化日期:
to_char(to_date(jzbidt.dstartdate, 'yyyy-MM-dd hh24:mi:ss'), 'yyyy-MM-dd'),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.