LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 09-25-2006, 08:10 PM   #1
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
Convert Time String to DATETIME field


What is the best way to convert a time like this:

Code:
Sep 21 12:34:56 2006
To something that MySQL can understand like a DATETIME field? Thanks.
 
Old 09-25-2006, 08:16 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Actually, you've a got a whole BUNCH of different options. Especially if you're calling MySQL from PHP.

Anyway, here's a good place to start:
http://dev.mysql.com/doc/refman/5.0/...functions.html
 
Old 09-25-2006, 08:20 PM   #3
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Original Poster
Rep: Reputation: 30
Thanks for the reference. Here is what I ended up using:

Code:
str_to_date('Sep 21 12:34:56 2006','%b %e %T %Y')
Thanks again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the ninth (9th) character or field in the output string of rpm -V ? zimon Linux - Distributions 1 08-28-2006 03:47 PM
How to convert string to char? twirl Programming 27 10-13-2005 08:11 AM
Can we specify variable field width in a scanf() format string? skie_knite007 Programming 3 05-13-2005 01:56 PM
convert date time format given in string suchi_s Programming 6 01-10-2005 05:06 AM
Mysql/PHP query problem with datetime field. Pcghost Programming 2 11-11-2003 01:24 PM


All times are GMT -5. The time now is 02:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration