Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'debugger': 0.09; 'objects,': 0.09; 'cc:addr:python-list': 0.11; 'stored': 0.12; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'igor': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'help.': 0.21; 'feb': 0.22; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'possibly': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'field,': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; 'received:google.com': 0.35; 'shows': 0.36; 'pm,': 0.38; 'previous': 0.38; '12,': 0.39; 'generating': 0.39; 'field.': 0.61; "you're": 0.61; 'show': 0.63; 'real': 0.63; 'field': 0.63; 'as:': 0.81; 'milliseconds': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=izQap/h2xsFOQRlKGoGLondEvkWo9RBMbRk83mOj6Ls=; b=OjEeGNeUL2s60bliGiG3oFqj9XnCwnlW1T3CkHtUyQ+ZjfgfIYUcOMnn9F026TUa9F v5XoGy33pusV8wepQvmWtm93nuxdsTzd2BRclV8Ilx/h1hzE1OJynkihSW1zcJKmpwdI xH7pRdz45RD/B00TCSnlFBKrKY0NtXGo1UqXJINd/LDOw2z09POW8fV7vy6Tj4Rd2u+K ITgsNWv3GEKUG19babROq1ADJL6YtSfoVFPNLaNepGDKb/37JiIw7zYF89O+1NW0PEvE cZ431TdhKo60OboT22xWVLQJ/iwkBlJ6TDdPRaelNWgvsecYStz9XFI1Q8FvlN0pWr97 35PQ== MIME-Version: 1.0 X-Received: by 10.68.112.164 with SMTP id ir4mr24694578pbb.153.1391849141370; Sat, 08 Feb 2014 00:45:41 -0800 (PST) In-Reply-To: References: Date: Sat, 8 Feb 2014 19:45:41 +1100 Subject: Re: datetime formatting output From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391849150 news.xs4all.nl 2833 [2001:888:2000:d::a6]:47525 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65652 On Sat, Feb 8, 2014 at 7:40 PM, Igor Korot wrote: > I am reading data from the DB (mySQL) where the datetime field is stored as: > > 2012-12-12 23:59:59.099 > > When I retrieve this date I am successfully see under debugger the dateteime > object with (2012, 12, 12, 23, 59, 59, 099) > > However as you can see from my previous post this date shows up incorrectly > as: > > 2012-12-12 23:59:59.000099 > > Notice 3 extra 0's in the milliseconds field. It's not a milliseconds field, that's why :) The real question is: Why is the datetime you're getting from MySQL putting milliseconds into the microseconds field? Possibly if you show your code for generating those datetime objects, that would help. ChrisA