date format

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

date format

Post by m2babaey »

Hi
when you check phpmyadmin you find the default format of date yyyy-mm-dd
can that be changed be work properly ( work properly means enable us to select result between 2 special days)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What does the format have to do with selecting between "2 special days"?
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Post by m2babaey »

feyd wrote:What does the format have to do with selecting between "2 special days"?
I just said something in the air
But you mean it's possible to change the date format?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

m2babaey wrote:But you mean it's possible to change the date format?
No, he asked a fairly simple question. What are you trying to do?
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Post by m2babaey »

I have made a payment tracking system and use popup date picker.
look at http://pedia.sys17.net/payment/insert.php
(username=exodus pass: digital )
that date picker sends this format: mm/dd/yyyy
but my date field in database is yyyy-mm-dd (or yyyy-dd-mm)
so the data will not be inserted in the database. so i'd like to change the database date format
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You could convert the format before handing the data off to the database.. :o
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Post by m2babaey »

you mean I correct the data i'm sending to database instead of changing the date format of the database field?
that's right. but since I used a popup date picker Java script and do not know JAva myself (get the script from the net) I didn't know how to change the date fromat the popup date picker results in. this is why i thought maybe i can change the date format of the database field :P
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

....in PHP....
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You put it in the database however you want. MySQL can't force you to use their date format. If you really want to use a different format, you go ahead and do it. Make a varchar field for dates and knock yourself out.

However, you'll lose the ability to use MySQL date functions, and you'll no longer be able to order results accurately by date (unless you keep a year-month-day-hour-minute-second format).
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

Post by m2babaey »

However, you'll lose the ability to use MySQL date functions, and you'll no longer be able to order results accurately by date (unless you keep a year-month-day-hour-minute-second format).
this is the answer of the second post:
What does the format have to do with selecting between "2 special days"?
Post Reply