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:
 
<input type="text" name="new_nsentrydate" value="01.01.2000" size="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: 
 
<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 = "_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd()), nsname = new_nsname,
                              nsadresse = new_nsadresse, nslocation = new_nslocation,
                              nscountry = new_nscountry, nsbirthday = "_.DateTime(new_nsbirthday)" '%s/%s/%s' % (year(), mm(), dd()),
                              nsbirthplace = new_nsbirthplace, nstext = new_nstext,
                              nsstatus = 0, nstype = new_nstype, nssociety = new_nssociety,
                              nsservice = new_nsservice)">

i get the folowing error:
 
Invalid attribute name, "_.DateTime(new_nsentrydate)", for tag <dtml-call "insertNoteService(nsentrydate = "_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd()), nsname = new_nsname, nsadresse = new_nsadresse, nslocation = new_nslocation, nscountry = new_nscountry, nsbirthday = "_.DateTime(new_nsbirthday)" '%s/%s/%s' % (year(), mm(), dd()), nsbirthplace = new_nsbirthplace, nstext = new_nstext, nsstatus = 0, nstype = new_nstype, nssociety = new_nssociety, nsservice = new_nsservice)">, on line 4 of addNoteService_html
 
with this code :
 
<dtml-call "insertNoteService(nsentrydate = "_.DateTime(new_nsentrydate)" '%s/%s/%s' % (year(), mm(), dd())", nsname = new_nsname,
                              nsadresse = new_nsadresse, nslocation = new_nslocation,
                              nscountry = new_nscountry, nsbirthday = "_.DateTime(new_nsbirthday)" '%s/%s/%s' % (year(), mm(), dd())",
                              nsbirthplace = new_nsbirthplace, nstext = new_nstext,
                              nsstatus = 0, nstype = new_nstype, nssociety = new_nssociety,
                              nsservice = 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=sql-quote>', '<dtml-var nsadresse fmt=sql-quote>', '<dtml-var nslocation fmt=sql-quote>', '<dtml-var nscountry fmt=sql-quote>', '<dtml-var nsbirthday>','<dtml-var nsbirthplace fmt=sql-quote>', '<dtml-var nstext fmt=sql-quote>', <dtml-var nsstatus>, <dtml-var nstype>, <dtml-var nssociety>, <dtml-var nsservice>)  
 
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="'01.01.1900'">
 <dtml-var "_.DateTime(tert)" fmt="%Y/%m/%d">
</dtml-let>
 
i get 2036/02/07         Why?
when i use this code :
 
<dtml-var "_.DateTime('01.01.1900')" fmt="%Y/%m/%d">
 
i get 2036/02/07         Why?
when i use this code :
 
<dtml-var "ZopeTime('01.01.1900')" fmt="%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...                       
 
 
 
$Regards
 
MM

Reply via email to