Date formatting problems
I am trying to format the dates in my Squishdot site so that they don't appear in American format. However, the following code: <dtml-var date_created fmt="%d/%m/%Y - %H:%M"> results in an error message saying Error Type: TypeError Error Value: illegal argument type for built-in operation Does anyone have any idea what I am doing wrong? ------------------------------------------------- Craig Stoddart IT Software Development Officer Dundee City Council IT Division Northern College Technical Block Gardyne Road Dundee DD5 1NY Phone: 01382 438170 Fax: 01382 438002 E-mail: craig.stoddart@dundeecity.gov.uk -------------------------------------------------
<untested> <dtml-var "date_created.strftime('%d/%m/%Y - %H:%M')"> </untested> Andreas ----- Original Message ----- From: "Craig Stoddart" <craig.stoddart@dundeecity.gov.uk> To: <zope@zope.org> Sent: Wednesday, June 13, 2001 12:23 PM Subject: [Zope] Date formatting problems I am trying to format the dates in my Squishdot site so that they don't appear in American format. However, the following code: <dtml-var date_created fmt="%d/%m/%Y - %H:%M"> results in an error message saying Error Type: TypeError Error Value: illegal argument type for built-in operation Does anyone have any idea what I am doing wrong? ------------------------------------------------- Craig Stoddart IT Software Development Officer Dundee City Council IT Division Northern College Technical Block Gardyne Road Dundee DD5 1NY Phone: 01382 438170 Fax: 01382 438002 E-mail: craig.stoddart@dundeecity.gov.uk ------------------------------------------------- _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Craig, FYI, have you tried: <dtml-var ZopeTime fmt="%d/%m/%Y - %H:%M"> ? It works for me, which makes me think that there may be a problem with your date_created object. Is it a DateTime object? Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Craig Stoddart Sent: Wednesday, June 13, 2001 9:23 AM To: zope@zope.org Subject: [Zope] Date formatting problems
I am trying to format the dates in my Squishdot site so that they don't appear in American format.
However, the following code: <dtml-var date_created fmt="%d/%m/%Y - %H:%M"> results in an error message saying
Error Type: TypeError Error Value: illegal argument type for built-in operation
Does anyone have any idea what I am doing wrong? ------------------------------------------------- Craig Stoddart IT Software Development Officer
Dundee City Council IT Division Northern College Technical Block Gardyne Road Dundee DD5 1NY
Phone: 01382 438170 Fax: 01382 438002 E-mail: craig.stoddart@dundeecity.gov.uk -------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
FYI, have you tried: <dtml-var ZopeTime fmt="%d/%m/%Y - %H:%M"> ?
It works for me, which makes me think that there may be a problem with your date_created object. Is it a DateTime object?
I think this is where the problem is - the variable <dtml-var date_created> used in Squishdot Sites seems to be stored as a string rather than as a DateTime Object. Is there any way I can convert it to dd/mm/yyyy format even though it is a string? Thanks, ------------------------------------------------- Craig Stoddart IT Software Development Officer Dundee City Council IT Division Northern College Technical Block Gardyne Road Dundee DD5 1NY Phone: 01382 438170 Fax: 01382 438002 E-mail: craig.stoddart@dundeecity.gov.uk -------------------------------------------------
Craig Stoddart wrote:
I think this is where the problem is - the variable <dtml-var date_created> used in Squishdot Sites seems to be stored as a string rather than as a DateTime Object. Is there any way I can convert it to dd/mm/yyyy format even though it is a string?
Read the changes for version 1.1.0 at: http://www.squishdot.org/Documentation/Changes date_created is near useless ;-) Use <dtml-var "date_posted('%d/%m/%Y'"> or <dtml-var date fmt="%d/%m/%Y"> When you're done, could you write a How-To on this and post it to Squishdot.org? :-) cheers, Chris
participants (4)
-
Andreas Jung -
Chris Withers -
Craig Stoddart -
Eric Walstad