473,505 Members | 15,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to enter date

48 New Member
Hello everyone,
Since I am very new to programming, I am struggling with this issue. Please show me how to write current date and how to calculate duration time between today's date and previous date.

Andy
Nov 27 '06 #1
5 4750
bartonc
6,596 Recognized Expert Expert
Here's a tidbit to get you started:
Expand|Select|Wrap|Line Numbers
  1. # This module has lots of output formating, but date objects do print
  2. from datetime import *
  3.  
  4. dataOjb = date(MINYEAR, 1, 1)
  5. todaysDate = dataOjb.today()
  6. print todaysDate
  7.  
  8. birthDate = date(1963, 1, 28)
  9.  
  10. print todaysDate - birthDate
Nov 27 '06 #2
bartonc
6,596 Recognized Expert Expert
Hello everyone,
Since I am very new to programming, I am struggling with this issue. Please show me how to write current date and how to calculate duration time between today's date and previous date.

Andy
Hey, Andy. Since this is your first post in the Python forum, I'd like to welcome you and ask: have you given up on C++ for something just as powerfull, but a lot easier to learn? Just ask me and I'll tell you "good choice".
Nov 27 '06 #3
coolindienc
48 New Member
Hi bartonc,
No have not, but this being my first programming course in school, i do not really have a choice. However, I am learning C++ as well. Just wasn't sure how different this language is. So far this seems easier than C++. Thanks for your help.
Nov 27 '06 #4
coolindienc
48 New Member
however, I was looking to see if I can manually input previous date just as we write in real life.

Andy
Nov 27 '06 #5
bartonc
6,596 Recognized Expert Expert
however, I was looking to see if I can manually input previous date just as we write in real life.

Andy
This will get ints for passing to other fuctions:

Expand|Select|Wrap|Line Numbers
  1. thedate = raw_input("Enter data as mm/dd/yyyy: ")
  2. month, day, year = (int(val) for val in thedate.split('/'))
Nov 27 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2168
by: Dan | last post by:
Hello, I need a good way to have my users enter the date and time into a form. Could someone please give me some ideas here. What is the preferrable method for doing this in an asp form page? ...
3
15917
by: David Kuhn | last post by:
I have a query with a date field criteria of: Between And When the query is run, I am asked for the Start date and then the End Date. So far, so good. The records returned are all those in...
1
1862
by: Bob Hynes | last post by:
Hi All, In access97 I have an unbound textbox with the format property set to 'short date' and an input mask of 99/99. In the after update event of the textbox I have code; me!textbox =...
2
3267
by: buck | last post by:
I'm working on a helpdesk database - does anyone know how to auto enter the date in a new record; would it be soemthing like iif field is null auto enter?
0
1591
by: KGrein | last post by:
Hi. I have a form that contains a combo box with customer number & customer name in it. The form is called F_DeleteUSCust and the combo box is named CB_getUScust It picks up the information for...
0
1677
by: Greg | last post by:
I am working on an application that requires working with numbers in scientific notation. I am using SqlServer as the database and I have created strongly typed data adapters and datasets. The...
5
6801
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter...
0
1483
by: mlarson | last post by:
I have a program that worked fine then they needed to be able to also see the empty cells (inmate cells) on a housing unit when they ran the query. So what I had to do was take two tables and...
3
4481
by: Bob Sanderson | last post by:
I have a PHP web page which uses a HTML form. I would like to enter dates into the date fields using a JavaScript calendar, similar to the way phpMyAdmin does. Can anyone recommend a JavaScript...
2
1279
by: tbeers | last post by:
Good afternoon. I think I could think my way through this and waste days trying to figure it out but why not use this resource. In access 2007 I have a time mangement database that basically is...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.