473,382 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Entering a date into mysql

8
Ok this is probably going to be so obvious but I've got to ask because I can not find it any other place.

I'm creating (still, this has been going on for some time now) a web based scuba dive log database and of course I'd like to enter the date that the dive took place.

I understand that mysql stores the date information in the YYYY-MM-DD and if I use lets say phpmyadmin to enter the data for the dive and of course use the above format to enter the date everything is great.

But when I start getting the web side of things going I don't want to have to enter it in that format but rather the 'usual way' of MM-DD-YYYY

How do I accomplish this ? This might be better posted in the PHP forum but thought I'd start here first. PHP/MySQL along with CSS and xhtml are the languages I'll be using ( as I'm sure you might have guessed I'm not a programmer!! LOL)

Thank you for your help
Jun 12 '08 #1
3 1742
Atli
5,058 Expert 4TB
You can use PHP's strtotime and date functions to convert just about any know English date-time format into an acceptable DateTime and TimeStamp format.
Like, for example:
Expand|Select|Wrap|Line Numbers
  1. $original = "June 12th 2008, 8:53:24 PM";
  2. echo date("Y-m-d H:i:s", strtotime($original));
  3. # Outputs: 2008-05-15 20:53:24
  4.  
Jun 12 '08 #2
Markw
8
Atli,

Thank you for the quick response. I figured it would be something easy, just didn't know were to start looking.

Again Thank you

Mark
Jun 12 '08 #3
Atli
5,058 Expert 4TB
Glad I could help :)
Jun 12 '08 #4

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

Similar topics

2
by: Ben | last post by:
I would like to use php to query a database and retrieve a unix timestamp. The problem is that mysql is storing the data in the date format and not a timestamp. I am sure that I can amend my...
2
by: Yulia Yegenov | last post by:
I have a query that looks like this: (I insert the date created with the php date function) $status = "Active"; //(I cannot use the mysql timestamp function for other reason). $curdate =...
5
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB...
4
by: MyOracle | last post by:
Hi everybody, I just curious about change date(0000-00-00) to date (00-00-0000) in mysql.Can anyone tell me about that. Thanks. izmanhaidi.
10
by: Newsscanner | last post by:
Hello, In my MySQL database, one of the fields eople have to fill in is "DOB" (Date of Birth). I have now managed to begin inserting data into my DB via a form, the data type for the DOB field...
3
by: dave | last post by:
I need to compute an expiration date based on the number of hours, days, or months purchased. The expiration date needs to be expressed in minutes something like '1260481600'. How can I get the...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
10
by: WebCM | last post by:
There is a function: http://paste.ubuntu.com/21865 It needs GMT date in YYYY-MM-DD HH:MM:SS format - in SQL: datetime. If date is the same as today, the function returns "Today". There is one...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.