iccaros Posted July 12, 2006 Report Share Posted July 12, 2006 I need to put a date in this format to a stringYYYYMMDDHHMMSSthis is what I have so far#!/usr/bin/env python#program will write HBF files for Windows side.import datetimeimport sysimport time#declare stringstoday = datetime.date.today()fileLocation = sys.argv[1]device = sys.argv[2]filename = fileLocation+str(today)+'.hbf'file = open(filename, 'w')file.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')file.write('<HEARTBEAT>\n')file.write(' <Date>'+str(today)+'</Date>\n')file.write(' <Server>'+device+'</Server>\n')file.write('</HEARTBEAT>\n')file.close()I have it creating a date and converting to string but I need a diffrent format.. my simple searches have not helped much Quote Link to post Share on other sites
iccaros Posted July 12, 2006 Author Report Share Posted July 12, 2006 got ittoday = time.strftime('%Y%m%d%H%M%S') Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.