python - remove time from django DateTime in Django -


So I will have to remove the date time, so get me only the date, year and month.

  "2014-04-17T00: 00: 00"   

I looked at different occasions but it does not work

  class list (model model): manufacturer = model.carfield (max_long = 255) model = model.carfield (max_long = 255) description = model. Textfield (max_long = 255) count = model.IntergerField (max_long = 255, default = 1) location = Models.ForeignKey ('location', empty = true, empty = true) cover = model .Filefield (upload_to = 'static / images / ', Default =' static / images / no-image.png ') Created = models.DateTimeField (auto_now_add = true) Barcode = Model. Chargefield (max_length = 255) assigned = model. Forngi (user, blank = true, empty = true) check = model Boolean field (default = false) modified = model DataTamField (default = datetime .datetime.now) tags = TaggableManager (= none, via empty = True) def __unicode __ (self): returns '% s'% date (self.modified, "n / j / y ") Def format_date (obj): return obj.modified.strftime ('% d% b% Y% H:% M') format_date.short_description = 'modified'    

This works for me.

  def get_date (auto): return self.modified.date ()    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -