Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to concatenate datetime.date object and datetime.time object

Reply
Thread Tools

How to concatenate datetime.date object and datetime.time object

 
 
Will Rocisky
Guest
Posts: n/a
 
      08-05-2008
Actually I am trying to save both date and time in one cell but they
are given separately by user.
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      08-05-2008
On Tue, 05 Aug 2008 02:25:34 -0700, Will Rocisky wrote:

> Actually I am trying to save both date and time in one cell but they are
> given separately by user.


What's a "cell"?

I suggest building a datetime.datetime() object:

>>> date = datetime.date(2008, 8, 5)
>>> time = datetime.time(19, 54)
>>> datetime.datetime.combine(date, time)

datetime.datetime(2008, 8, 5, 19, 54)

I discovered this by opening an interactive session and calling
help(datetime).


--
Steven
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Concatenate/De-Concatenate Carlos VHDL 10 10-24-2012 01:04 PM
concatenate file-like objects -> file-like object kgk Python 1 07-11-2007 06:17 AM
Concatenate datalist variables with javascript and html Luis Esteban Valencia ASP .Net 0 01-20-2005 01:57 PM
concatenate in Javascript function? simple field validation funciton not working - needs to concat field name with object NotGiven Javascript 7 07-24-2003 11:44 AM



Advertisments