Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




What Format Should I Save My Date Info In MySQL


I have to 2 questions:

1) What format should I save my date info in mySQL?

2) Is mm/dd/YYYY  '10/31/2004' a good solution?

Users can do search and display data from certain date to certain date.

How do pros go about it? date >'10/31/2004' and date < '11/31/2004'?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Pull Info From One Database To Save In A Session To Push To A Different DB
I'm building a dynamic site that has 3 data bases. One DB contains all
of my store info ID#, Name, Address, Phone. Another DB contains member
info ID, Name, address, email,phone,etc...
The 3rd DB Tracks when a user logs in and logs out at a store. This DB
has the following columns Store ID, Member ID, log in time,log out
time, time in store.

The stores log in in the morning that starts a session-I need the
session to pull the store's info ID#, Name,etc... so when a user logs
in, in the store. The login page inserts the store ID, Store name, and
user ID into the 3rd DB.

There are a lot of stores how do I get the store variables to be
inserted into the DB?

Date Format Store In Mysql Table Likes Oracle Format( Dd-mmm-yyyy)
Can you store date in MySQL likes oracle format (dd-mmm-yyyy) ?

MySQL Date/Time Format?
My hosting company has a utility which allows me to dump the tables of a MySQL database in csv format for Excel. However, I can't figure out how to translate the numbers in date/time fields.

Displaying A Mysql Date In A Different Format
I am trying to display the date of when the record was entered ina different format I.E. dd,mm,yyyy but I have completely no idea how to do it My code is:

Change The Date Format To Dd/mm/yyyy In Mysql
Ive a small problem(so to speek,infact its been buggin me for 2 days).I am using java and phpmyadmin(wamp).I just migrated my database from access to mysql and came to know the format of mysql date is of type datetime and the time format is yyyy-mm-dd.Iwant to change it to dd/mm/yyyy.I have checked the mysql documentation but coudnt really get the point.I have decided to change the format in my query(is wat i read in a post) which is advisable.My query goes this way-->

INSERT INTO Internal_Publicity_Details (Branch,Publicity_Nature,Brief_Part1,Brief_Part2,Brief_Part3,Brief_Part4,Specifics_1,Specifics_2,Specifics_3,Specifics_4,Publicity_Media,Publicity_Period,Market_Coverage,Proposed_By,Req_Date,Remarks,Id_No) VALUES
i am entering the date values from my jsp form.Here Req_Date(bold) is my date column.the date which the user will enter is random ie.for example
20/11/2006 or 20/12/2004 like this.please help me regarding this as m completely new to database.I even tried something like this which went horribly wrong -->

INSERT INTO Internal_Publicity_Details (Branch,Publicity_Nature,Brief_Part1,Brief_Part2,Brief_Part3,Brief_Part4,Specifics_1,Specifics_2,Specifics_3,Specifics_4,Publicity_Media,Publicity_Period,Market_Coverage,Proposed_By,Req_Date,Date_Format(`Req_Date`,'%d/%m/%Y'),Remarks,Id_No) VALUES

Loading Date Format 1-1-2007 To Date Field Doesn't Work
I'm trying to load the date into a date field in mysql so that I can sort by date, but the date field in mysql is yyyy dd mm or yyyy mm dd so it doesn't load. What can I do?

Save Picture Files (.jpg) In Database Records Or Save Only Links To (.jpg)
I dont know what is more eficient. What do you think is better, put in pictures physically in records in database or put in links to pictures in records?

How To Sort User's Info By Date Of Arrival?
Let's me  explain; I have  an email form which sends  the  user's info directly to a  table that  storage the name, email, subject, message, and the time  it  arrived. I need  to  create a  form report which let me know mails that arrived either today, yesterday, or  even  one week  ago.

I would  like  to  know  how  to query the  database to display the user  info by  date of arrival and  display the result into a table.

Format Date
Does anyone know if it is possible to format a date column when creating a table, cannot seem to find anything on this only on formatting when retrieving the data?

Date Format
i'm using visual foxpro 9 with a mysql 5 database, for direct access to my
database i use navicat. In visual foxpro i've set my date format to
dd-mm-yyyy, also i did this in navicat.

However when i insert a date into my database i have to insert it with the
format yyyy-mm-dd. Is this a setting in mysql or is there another reason?

Date Format
I have developed several applications in Delphi. I used Paradox for my data
storage. Now, I want to convert these databases to MySql.
So that why I am looking for a way to convert the date format from
YYYY-MM-DD to MM/DD/YYYY.

Date Format
i have created a table with "date" as one of the field.
i have noticed that "Y/M/D" is the default format for date fields.

how do i change the tables date format into "M/D/Y" ?

Date Format
I recently converted data and discovered that when the date wasn't formatted
properly '01/01/001' (I think) that I was unable to find the record using
Sql i.e 'Select * from table where order_#=100' . However, using utilities
(Navicat) I was able to find the record. Any reason?

Date Format
by default, the date format is aaaa-mm-jj.
i want a format like jj/mm/aaaa

Date Format
im using mysql with php and mysql seems to store the date in the format 0000-00-00.
so that is the year and then the month and then the date?? is there anyway i can change that so that it can b in the format dd/mm/yyyy?

Date Format
When I make a column type as DATE it stores it in the format YYYY-DD-MM.

How can I make mysql store it as MM-DD-YYYY?

The Date Format
ive got a field which is with a data type datetime. problem is the date format seems to come up as YYYY/MM/DD and i want it the british way which is dd/mm/yyyy. does anyone know how i can change this format? (i dont know how to alter tables also).

another thingi want to do is for the database to automatically fill this field in for me with the date and time. is this possible or would this info need to be filled in by the user?

Date Format
i am working in C#asp.net(2005) with mysql. i am passing date from my form as dd/mm/yyyy format.if i insert that date in database it's not getting inserted as date.it's getting inserted as 00. so please give me query to comvert dd/mm/yyyy to mysql native date format.

Date Format
Isn't the following date format supposed to work with any installation of MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.

Date Format
I am trying to create an order by in a select statement that takes a
standard 'date' column in a table and sorts the returned data by the month
of that date.

Off hand, I tried

ORDER BY start_date(m)

And I know that is wrong. Anyone have any suggestions?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=...sie.nctu.edu.tw

DATE Format
I am using PHP myadmin to setup my mySQL database. The format I choose to store my date text field was DATETIME. How can I choose a different format for the DATE?

All I want is a: 12-7-2007 format and don't want to put in a time but it's expecting the time as well.

Date Format
I've followed what the manual said but I can't figure out how to apply it to my select statement which is as follows:

$query = "SELECT * FROM board WHERE BoardMemberTitle='President'";
$result = mysql_query($query);
echo "<ul>
";
while($row = mysql_fetch_assoc($result))
{
echo "<div class="boardmembername">" . $row['BoardMemberName'] . "</div>" . "<div class="boardmemberterm">" . $row['BoardMemberTerm']. "-year" . "</div>" . "<div class="boardmemberelection">" . $row['BoardMemberElection'] . "</div>";
}
echo "</ul>
";
mysql_free_result($result);

[boardmemberelection] is the field that needs to have the format changed but since I've used * for the select statement I don't know how to use the date_format function

is it just that I need to use the individual fields instead of the * ?

Date Format
I have a table with a column of type date. Through my VB app, it inserts the date as 0000-00-00 (which is a separate problem) but if I insert a record manually into the DB, it inserts today's date as 2015-08-20 as opposed to 15-08-2006.

Date Format
What's the best format for adding a date to a table? I was using "20040520
10:39:31", but now it's giving me the error: '20040520 10:39:31' is not a
valid date and time.

Date Format
if it is possible to insert into a mySQL db a date format formatted like so: 11-Oct-06.

I would like to save myself any tedious string processing tasks (I know I could convert it with PHP...).

Date Format
Isn't the following date format supposed to work with any installation of
MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.

Date Format
How can I change the way the date format is held ? even when I change timezone and localisation settings the date sets to American format - Currently im having to use a varchar so that it will accept a correct date format but I would like to be able to use the date functions ( from php etc) to manipulate the data
I dont want the front end to have to alter the dates to American before it posts to the db Currently the format is YYYY /MM /DD - thought i could use a set type perl/php to set the format to DD/MM/YYYY

Date Format
When I set up the database, I set a date field to type: date and gave it 8 characters. It wants to save in the format 0000-00-00, but I want the year to be last. Is there a way to do this?

Date Format Issue
I have an existing date in a field in the format of yyyy-mm-dd. I need to convert that to ISO standard 2822.

Date Format And WHERE Clause
I have a question about a fiedl that I have in my table that has a date/time datatype.

DOS is the date/time field

I am trying to use this sql in Coldfusuion:

SELECT * FROM Shows WHERE Shows.DOS = '#Form.GigDate#'
ORDER BY DOS ASC

I keep getting a datatype mismatch error.

My date field has a Short Date format and I wondered what I am doing wrong in my sql and i believe it is in the WHERE clause.

Do I need something around the DOS part of that sql?

Date Format In Database
I created a field name in mysql database as follows:

Field - date
Type - date
Length/Values -
Attributes -
Null - not null
Default - dd-mm-yy
Extra -

For some reason the "Default" setting keeps going to 0000-00-00

Every time I change it, it keeps going back to 0000-00-00

Can I Change The Date Format...
Is there anyway to change the default date format
(possibly in a .ini or .cfg file) from YYYY-MM-DD to
another format ? (ie, mm/dd/yyyy or any user-defined
format).

The useage that I'm looking at is to import a CSV file
into a table (using Load data infile .... command)
where dates are stored in mm/dd/yyyy format and can
change based on the source of the data. I can import
the date fields into a char field and then convert it
but would like to save the time to transform and copy
contents into another table.

Get Date In A Specific Format
which function can I use to select the date in order to return date in this format YYYY-MMM-DD .

Load With Date Format
I have date values in mm/dd/yy format in a text file. How can use the LOAD command or mysqlimport command and load those date values. Currently I just load the date values as text into MySQL tables and manipulate the text in applications. There must be a better way? can I use DATE_FORMAT or something like that?

Compare Two Different Date Format
Take a look into the following select statements:

Select Date_Format(TS_Post_DT,"on %e/%c/%Y at %T"), UI_Login FROM Topic_Start LEFT JOIN User_Info ON TS_UI_ID=UI_ID WHERE TS_D_ID='.$row['D_ID'] .' LIMIT 1'

SELECT Date_Format(User_Option.UO_Last_Login,'on %e/%c/%Y at %T') FROM User_Option LEFT JOIN User_Info ON User_Option.UA_UI_ID=User_Info.UI_ID WHERE User_Option.UA_UI_ID=".$_SESSION['id'];

I want to compare the two Date_Format fields.....how can i do this thing?

How i can print the row Date_Format(User_Option.UO_Last_Login,'on %e/%c/%Y at %T') after the execution of the query......I used the row[0]

Format Date On Insert
I have a little issue storing dates...

The dates are stored in the database as: yyyy-mm-dd

The dates are displayed on my webpage as simply: mm/dd

I accomplished this using DATE_FORMAT(dateValue, '%m/%d') in my SELECT statement.

now, the user has the option of changing the dd or mm and then save the changes. However, since the formats do not match the date is always 0000-00-00 (in the DB).

Is there are way to format the date in the INSERT statment, and somehow turn mm/dd into yyyy-mm-dd (yyyy=the current year) so that it will save properly?

Date Changes Format When Submitted
Got a form in Dreamweaver for date. User needs to be able to key in the date as MM-DD-YYYY, but it gets inserted into the MySQL table as YYYY-MM-DD, but the numbers are all messed up. meaning it doesn't just turn them around...

What am I doing wrong? Is there some sort of code i need to use to change the format around??

Date Format Conversion
how to convert the date format in mysql. The conversion shall be updated in the system and not at run time in my software. Exactly in my queries, processed from mysql.exe, I would like to see the format as: day/month/year (European format).

Date/Time Format From CSV
I have a rather large csv file that includes many dates that I would like to import into MySQL. The problem that I am having is that the dates are DD/MM/YYYY HH:MM:SS, and MySQL does not accept them in its YYYY-MM-DD HH:MM:SS format. Any ideas how to convert this properly?

Convert Date Format
Im trying to insert date in Mysql in the format MM/DD/YYYY. It gets stored in the table as YYYY-MM-DD. Now i need to retrieve back the format as MM-DD-YYYY.

Change The Date Format
I have loaded the *.txt file to the MYSQL DB. However, there is on field column carrying the date format in dd/MM/yyyy. How could I suppose to change the date format to the default MYSQL date format, or by other method?

Select Date Format
In the data base dates are saved in this format:
1945-04-24 00:00:00
Can I select eg: "SELECT DOB from DB" them so they are returned as YYYY-MM-DD?

Date Format Changing
I am getting a date in the format mm/dd/yyyy from outside. I have to format it to yyyy-mm-dd in the sql query that i have written.I tried DATE_FORMAT() function. But, I am getting weird output for the format.

Date Interval With Format
Code:
SELECT NAME,DATE_FORMAT(DATEBORN,'%d/%m/%Y') AS BDAY WHERE WEEK(DATEBORN) = WEEK(CURRENT_DATE()) ORDER BY DATEBORN ASC

This script is executed every friday with cron, and shows all the people whom had birthday in last 7 days...

Now, How could I modify query to show something like:

"Listing of people whom had birthday between 20/07/2005 and 27/07/2005" (I'd like to know how to get the date limits in this interval of 7 days selected)

I mean, how to show date interval/range of people whom were selected in the script execution, no matter which day script was execd.

Date Format Ddmmyyyy
When I insert data into a table with a date colum the date is stored as yyyymmdd but I want it stord as ddmmyyyy.

Converting Format Of Date
I have a form where I get the date in MM-DD-YYYY format. I need to convert this value so I can INSERT INTO db. On my computer I have MySQL version 5.x. I used STR_TO_DATE() function and query worked on my computer. Server that I am uploading files using version 3.x. so the function doesn't work.

Is version 3.x has any function that I can replace STR_TO_DATE with? How can I solve this problem?

Date Format, Changing
on a form my users will put it "dd-mm-yyyy" how do i change that into the mysql format of "yyyy-mm-dd"?

Date Format Issue
the format for the date in our database is mm/dd/yyyy and when i get the current_date() to compare the two I have the problem of them being different

current_date() is yyyy-mm-dd (right?)
event_startDate is mm-dd-yyyy

I tried using the get_format() function to get them to be the same but it doesnt seem to be working correctly.
What I am trying to do is write a query that gets the information for the next upcoming meeting. Thus, the events_startDates needs to be greater than the current_date() and i merely grab the "closest" meeting or the first row as it were.
This is what i have so far. How do I get the dates to be comparable to each other?

$query = mysql_query("SELECT * FROM meeting_list, events WHERE event_startDate > current_date() AND eventID = ID AND event_type != 'Sales' ORDER BY event_dates ASC LIMIT 1");

Format Date In A Select Query
I'm storing dates in a db using the DATE-datatype in the YYYY-MM-DD format, now i want to show the dates on my webpage in the european DD-MM-YYYY format.

I have written the following SELECT-query but it doesn't seem to work.
The date is not shown when i show the results of the query.
The column where the dates are stored is called "startdate".

MySQL
$query  = "SELECT date_format(startdate, '%d %c, %Y'),cat,locatienaam,adres,postcode,stad,telefoon,contactpersoon FROM datasheet ";

this is what I do with the result of the query

MySQL
PHP

$result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)){    echo "<h2>{$row['locatienaam']} </h2>" .        "<h2>{$row['startdate']}</h2>" .         "<p>{$row['omschrijving']}</p> <br><br>";}

And it doesn't show the date when I use the SELECT query shown in the first post of this thread.


Copyright © 2005-08 www.BigResource.com, All rights reserved