von Karolus » Di, 04.09.2012 12:22
Hallo
Code: Alles auswählen
...
cell.FormulaLocal = datum.strftime('%d.%m.%Y')
...
http://docs.python.org/library/datetime ... e-behavior
Karolus
Ps. wenn dir Jahreszahl, Monat und Tag vorliegen, musst du dafür auch nicht datetime importieren, er reicht:
Code: Alles auswählen
context = XSCRIPTCONTEXT
def datum_a1():
"""
"""
doc = context.getDocument()
sheet = doc.CurrentSelection.Spreadsheet
cell = sheet.getCellRangeByName('A1')
cell.FormulaLocal = '%s.%s.%s' %( 3, 11, 1987 )
Hallo
[code]...
cell.FormulaLocal = datum.strftime('%d.%m.%Y')
...[/code]
[url]http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior[/url]
Karolus
Ps. wenn dir Jahreszahl, Monat und Tag vorliegen, musst du dafür auch nicht datetime importieren, er reicht:
[code]context = XSCRIPTCONTEXT
def datum_a1():
"""
"""
doc = context.getDocument()
sheet = doc.CurrentSelection.Spreadsheet
cell = sheet.getCellRangeByName('A1')
cell.FormulaLocal = '%s.%s.%s' %( 3, 11, 1987 )[/code]