[Zope] Date format question urgent!!!
Marko MARKOVIC
marko.markovic@isp.lu
Thu, 27 Jul 2000 09:33:39 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_001E_01BFF7AD.BF0A2820
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
hi all,
i have a few questions about date formating:
i work with a sybase database and have tables where i used date fields. =
My field entrydate is of type Date.
on my page i have a textbox to put the date:
=20
<input type=3D"text" name=3D"new_nsentrydate" value=3D"01.01.2000" =
size=3D"10">
i will formating it as 2000/01/01 and then put it in a sql query as a =
parameter. For the formating i use the follow code:=20
<dtml-with "_.DateTime(new_nsentrydate)">
<dtml-var " '%s/%s/%s' % (year(), mm(), dd())">
</dtml-with>
and i get 2000/01/01.
Here is my dtml-code:
<dtml-with "_.DateTime(new_nsentrydate)">
<dtml-var "'%s/%s/%s' % (year(), mm(), dd())">
</dtml-with>
<dtml-with "_.DateTime(new_nsbirthday)">
<dtml-var "'%s/%s/%s' % (year(), mm(), dd())">
</dtml-with>
with this code :
<dtml-call "insertNoteService(nsentrydate =3D =
"_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd()), nsname =
=3D new_nsname,=20
nsadresse =3D new_nsadresse, nslocation =
=3D new_nslocation,=20
nscountry =3D new_nscountry, nsbirthday =
=3D "_.DateTime(new_nsbirthday)" '%s/%s/%s' % (year(), mm(), dd()),
nsbirthplace =3D new_nsbirthplace, nstext =
=3D new_nstext,
nsstatus =3D 0, nstype =3D new_nstype, =
nssociety =3D new_nssociety,=20
nsservice =3D new_nsservice)">
i get the folowing error:
Invalid attribute name, "_.DateTime(new_nsentrydate)", for tag =
<dtml-call "insertNoteService(nsentrydate =3D =
"_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd()), nsname =
=3D new_nsname, nsadresse =3D new_nsadresse, nslocation =3D =
new_nslocation, nscountry =3D new_nscountry, nsbirthday =3D =
"_.DateTime(new_nsbirthday)" '%s/%s/%s' % (year(), mm(), dd()), =
nsbirthplace =3D new_nsbirthplace, nstext =3D new_nstext, nsstatus =3D =
0, nstype =3D new_nstype, nssociety =3D new_nssociety, nsservice =3D =
new_nsservice)">, on line 4 of addNoteService_html
with this code :
<dtml-call "insertNoteService(nsentrydate =3D =
"_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd())", nsname =
=3D new_nsname,=20
nsadresse =3D new_nsadresse, nslocation =
=3D new_nslocation,=20
nscountry =3D new_nscountry, nsbirthday =
=3D "_.DateTime(new_nsbirthday)" '%s/%s/%s' % (year(), mm(), dd())",
nsbirthplace =3D new_nsbirthplace, nstext =
=3D new_nstext,
nsstatus =3D 0, nstype =3D new_nstype, =
nssociety =3D new_nssociety,=20
nsservice =3D new_nsservice)">
i don't get Errors, but it doesn't work.
Here is my sql code:
INSERT INTO noteservice (ns_entrydate, ns_name,
ns_adresse, ns_location, ns_country, ns_birthday,
ns_birthplace, ns_text, ns_status, ns_type,
ns_society, ns_service)
VALUES('<dtml-var nsentrydate>', '<dtml-var nsname fmt=3Dsql-quote>', =
'<dtml-var nsadresse fmt=3Dsql-quote>', '<dtml-var nslocation =
fmt=3Dsql-quote>', '<dtml-var nscountry fmt=3Dsql-quote>', '<dtml-var =
nsbirthday>','<dtml-var nsbirthplace fmt=3Dsql-quote>', '<dtml-var =
nstext fmt=3Dsql-quote>', <dtml-var nsstatus>, <dtml-var nstype>, =
<dtml-var nssociety>, <dtml-var nsservice>) =20
when i use this code :
<dtml-with "_.DateTime('01.01.1900')">
<dtml-var "'%s/%s/%s' % (year(), mm(), dd())">
</dtml-with>
i get 1900/01/01
when i use this code :
<dtml-let tert=3D"'01.01.1900'">
<dtml-var "_.DateTime(tert)" fmt=3D"%Y/%m/%d">
</dtml-let>
i get 2036/02/07 Why?
when i use this code :
<dtml-var "_.DateTime('01.01.1900')" fmt=3D"%Y/%m/%d">
i get 2036/02/07 Why?
when i use this code :
<dtml-var "ZopeTime('01.01.1900')" fmt=3D"%Y/%m/%d">
i get 2036/02/07 Why?
Could you explain me how i must handle date fields in zope?
Finally, i want formatting a date as 2000/01/01 and then put in my table =
with a sql method.
Any suggestions or a good example will be apprecieated... =
=20
$Regards
MM
------=_NextPart_000_001E_01BFF7AD.BF0A2820
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial>hi all,</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>i have a few questions about date =
formating:</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>i work with a sybase database and have tables =
where i used=20
date fields. My field entrydate is of type Date.</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>on my page i have a textbox to put the =
date:</FONT></DIV>
<DIV><FONT face=3DArial> </FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><input type=3D"text"=20
name=3D"new_nsentrydate" value=3D"01.01.2000" =
size=3D"10"></STRONG></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>i will formating it as 2000/01/01 and then put =
it in a sql=20
query as a parameter. For the formating i use the follow=20
code:</FONT> </DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><dtml-with=20
"_.DateTime(new_nsentrydate)"><BR> <dtml-var " '%s/%s/%s' % =
(year(),=20
mm(), dd())"><BR></dtml-with></STRONG></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>and i get 2000/01/01.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial>Here is my dtml-code:</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><dtml-with=20
"_.DateTime(new_nsentrydate)"><BR> <dtml-var "'%s/%s/%s' % =
(year(),=20
mm(), dd())"><BR></dtml-with></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><dtml-with=20
"_.DateTime(new_nsbirthday)"><BR> <dtml-var "'%s/%s/%s' % =
(year(),=20
mm(), dd())"><BR></dtml-with></STRONG></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>with this code :</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial><FONT size=3D2><STRONG><dtml-call=20
"insertNoteService(nsentrydate =3D "_.DateTime(new_nsentrydate)" =
'%s/%s/%s' %=20
(year(), mm(), dd()), nsname =3D new_nsname,=20
<BR> &nb=
sp; &nbs=
p; =20
nsadresse =3D new_nsadresse, nslocation =3D new_nslocation,=20
<BR> &nb=
sp; &nbs=
p; =20
nscountry =3D new_nscountry, nsbirthday =3D "_.DateTime(new_nsbirthday)" =
'%s/%s/%s'=20
% (year(), mm(),=20
dd()),<BR> &nb=
sp; &nbs=
p; =20
nsbirthplace =3D new_nsbirthplace, nstext =3D=20
new_nstext,<BR> &nbs=
p;  =
; =20
nsstatus =3D 0, nstype =3D new_nstype, nssociety =3D new_nssociety,=20
<BR> &nb=
sp; &nbs=
p; =20
nsservice =3D new_nsservice)"><BR></STRONG></FONT><BR>i get the =
folowing=20
error:</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial><EM>Invalid attribute name, =
"_.DateTime(new_nsentrydate)",=20
for tag <dtml-call "insertNoteService(nsentrydate =3D=20
"_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd()), nsname =
=3D=20
new_nsname, nsadresse =3D new_nsadresse, nslocation =3D new_nslocation, =
nscountry =3D=20
new_nscountry, nsbirthday =3D "_.DateTime(new_nsbirthday)" '%s/%s/%s' % =
(year(),=20
mm(), dd()), nsbirthplace =3D new_nsbirthplace, nstext =3D new_nstext, =
nsstatus =3D 0,=20
nstype =3D new_nstype, nssociety =3D new_nssociety, nsservice =3D =
new_nsservice)">,=20
on line 4 of addNoteService_html</EM></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>
<DIV><FONT face=3DArial>with this code :</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><dtml-call=20
"insertNoteService(nsentrydate =3D "_.DateTime(new_nsentrydate)" =
'%s/%s/%s' %=20
(year(), mm(), dd())", nsname =3D new_nsname,=20
<BR> &nb=
sp; &nbs=
p; =20
nsadresse =3D new_nsadresse, nslocation =3D new_nslocation,=20
<BR> &nb=
sp; &nbs=
p; =20
nscountry =3D new_nscountry, nsbirthday =3D "_.DateTime(new_nsbirthday)" =
'%s/%s/%s'=20
% (year(), mm(),=20
dd())",<BR> &n=
bsp; &nb=
sp; =20
nsbirthplace =3D new_nsbirthplace, nstext =3D=20
new_nstext,<BR> &nbs=
p;  =
; =20
nsstatus =3D 0, nstype =3D new_nstype, nssociety =3D new_nssociety,=20
<BR> &nb=
sp; &nbs=
p; =20
nsservice =3D new_nsservice)"></STRONG></FONT></DIV><FONT=20
face=3DArial></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT face=3DArial></FONT></FONT> </DIV>
<DIV><FONT face=3DArial><FONT face=3DArial>i don't get Errors, but =
it doesn't=20
work.</DIV>
<DIV><BR></DIV></FONT>
<DIV>Here is my sql code:</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>INSERT INTO noteservice =
(ns_entrydate,=20
ns_name,<BR> ns_adresse, =
ns_location,=20
ns_country, ns_birthday,<BR> =
ns_birthplace,=20
ns_text, ns_status, ns_type,<BR> =
ns_society,=20
ns_service)<BR>VALUES('<dtml-var nsentrydate>', '<dtml-var =
nsname=20
fmt=3Dsql-quote>', '<dtml-var nsadresse fmt=3Dsql-quote>', =
'<dtml-var=20
nslocation fmt=3Dsql-quote>', '<dtml-var nscountry =
fmt=3Dsql-quote>',=20
'<dtml-var nsbirthday>','<dtml-var nsbirthplace =
fmt=3Dsql-quote>',=20
'<dtml-var nstext fmt=3Dsql-quote>', <dtml-var nsstatus>, =
<dtml-var=20
nstype>, <dtml-var nssociety>, <dtml-var =
nsservice>) =20
</STRONG></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>when i use this code :</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><dtml-with=20
"_.DateTime('01.01.1900')"><BR><dtml-var "'%s/%s/%s' % =
(year(),=20
mm(), dd())"><BR></dtml-with></STRONG></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>i get 1900/01/01</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV><FONT face=3DArial>
<DIV><FONT face=3DArial>when i use this code :</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG><dtml-let=20
tert=3D"'01.01.1900'"><BR> <dtml-var "_.DateTime(tert)"=20
fmt=3D"%Y/%m/%d"><BR></dtml-let></STRONG></FONT></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>i get=20
2036/02/07 =20
<STRONG>Why?<BR></STRONG></FONT></DIV>
<DIV><FONT face=3DArial>
<DIV><FONT face=3DArial>when i use this code :</FONT></DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><dtml-var =
"_.DateTime('01.01.1900')"=20
fmt=3D"%Y/%m/%d"></STRONG></FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>i get=20
2036/02/07 =20
<STRONG>Why?<BR></STRONG></DIV></FONT><FONT face=3DArial>
<DIV><FONT face=3DArial>when i use this code :</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2><STRONG><dtml-var "ZopeTime('01.01.1900')"=20
fmt=3D"%Y/%m/%d"><BR></STRONG></FONT></DIV>
<DIV>i get 2036/02/07 =20
<STRONG>Why?<BR></STRONG></DIV>
<DIV>Could you explain me how i must handle date fields in zope?</DIV>
<DIV> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV>Finally, i want formatting a date as 2000/01/01 and then put in my =
table=20
with a sql method.</DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV>Any suggestions or a good example will be=20
apprecieated... &nbs=
p;  =
; =20
</DIV>
<DIV> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><STRONG><EM>$Regards</EM></STRONG></DIV>
<DIV><STRONG><EM></EM></STRONG> </DIV>
<DIV><STRONG><EM>MM</EM></STRONG></DIV></FONT></BODY></HTML>
------=_NextPart_000_001E_01BFF7AD.BF0A2820--