python openpyxl time insert without date
<p>I have a value that I want to insert into excel as time formatted like HH:MM
If I use</p>

<pre><code>   cellFillTime =  Style(fill = PatternFill(start_color=shiftColor,end_color=shiftColor,fill_type='solid'),
                                      border = Border(left=Side(style='thin'),right=Side(style='thin'),top=Side(style='thin'),bottom=Side(style='thin')),
                                       alignment=Alignment(wrap_text=True)
                                      ,number_format='HH:MM'
valM = 8 

cellData = ws5.cell(column= a + 3, row= i+2, value=valM)
_cellStlyed = cellData.style = cellFillTime
</code></pre>

<p>I always get 1.1.1900 8:00:00 in excel worksheet</p>

<p>The problem I get is when I have SUM functions later and therefore they do not work.</p>

<p>How can I remove date from my cell when formatting cell to get only time values</p>

<p>thank you</p>

<p>best regards</p>

<p>This worked in terms of only hour insert</p>

<p>UPDATED CODE
     cellFillTime =  Style(fill = PatternFill(start_color=shiftColor,end_color=shiftColor,fill_type='solid'),
                                          border = Border(left=Side(style='thin'),right=Side(style='thin'),top=Side(style='thin'),bottom=Side(style='thin')),
                                           alignment=Alignment(wrap_text=True)
                                          )</p>

<pre><code> if rrr["rw_seqrec"] == 1 or rrr["rw_seqrec"] == 1001:
          val_ = abs((rrr['rw_end'] -  rrr['rw_start'])) / 60
          #print "val_ ", val_
          valM = datetime.datetime.strptime(str(val_), '%H').time()
          cellData = ws5.cell(column= a + 3, row= i+2, value=valM)
          cellData.style = cellFillTime 
          cellData.number_format='HH:MM'
</code></pre>

<p>the problem I have now is that excel still does not want to sum the time fields. It has smth to do with field format or smth.</p>

<p>any suggestions?</p>