Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75423
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'diff': 0.07; 'subject:two': 0.07; 'string': 0.09; 'python': 0.11; '2.7': 0.14; '24,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'i.e': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:dates': 0.16; 'subtract': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'entered': 0.20; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'skip:( 20': 0.30; 'skip:c 30': 0.32; 'skip:d 20': 0.34; 'possible.': 0.35; 'received:84': 0.35; 'dates': 0.36; 'so,': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'success.': 0.39; 'to:addr:python.org': 0.39; 'email addr:gmail.com': 0.63; 'soon': 0.63; 'p.s:': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=B4s30YdM c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=u9EReRu7m0cA:10 a=plw-dbNy16cA:10 a=sQIAIZ-qE08A:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=P5_uGKrK4_LFARTMzdkA:9 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Thu, 31 Jul 2014 17:35:10 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Subtracting two dates in python |
| References | <ea9aa6cd-1fe4-420e-ac11-c3ff2be3befa@googlegroups.com> |
| In-Reply-To | <ea9aa6cd-1fe4-420e-ac11-c3ff2be3befa@googlegroups.com> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12472.1406824701.18130.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1406824701 news.xs4all.nl 2909 [2001:888:2000:d::a6]:55467 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75423 |
Show key headers only | View raw
On 2014-07-31 17:08, eshwar080@gmail.com wrote:
> I would like to subtract two dates
>
> i.e I have entered a date into a textbox which is of type String like
> below
>
> type(waitForObject(":VWAP Calculator_LCDateTextField"), "07/24/14")
>
> I am capturing that date like below
>
> Current = (waitForObject(":VWAP Calculator_LCDateTextField").text)
>
> so, now I want to subtract the captured date with my current system
> date and get the difference in days. I tried many ways and see no
> success. Someone please help with this as soon as possible.
>
> P.S: I have python 2.4 and 2.7
>
Try the 'datetime' module:
>>> from datetime import datetime
>>> d = datetime.strptime("07/24/14", "%m/%d/%y")
>>> d
datetime.datetime(2014, 7, 24, 0, 0)
>>> diff = datetime.now() - d
>>> diff.days
7
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Subtracting two dates in python eshwar080@gmail.com - 2014-07-31 09:08 -0700 Re: Subtracting two dates in python John Gordon <gordon@panix.com> - 2014-07-31 16:31 +0000 Re: Subtracting two dates in python MRAB <python@mrabarnett.plus.com> - 2014-07-31 17:35 +0100
csiph-web