473,804 Members | 3,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Column formatting

Hi

Being new to mysql I have some queries about formatting a date column

1. Can I use dd-mm-yy, my website is Australian

2. Can I leave the date field in one row empty if the date is unknown.

3. If I only know the year an event took place, can I enter just the
year.

4. Would it be best if I used varchar for the column

thanks in advance for any help

Patricia May
Jul 20 '05 #1
2 1745
Patricia May wrote:
1. Can I use dd-mm-yy, my website is Australian
This page will propably answer many to your questions:
http://dev.mysql.com/doc/mysql/en/Da...functions.html

See for example DATE_FORMAT(dat e,format) function which you can use to
get dates in any format you like, from database. For inserting dates,
there are several methods, depends on your MySQL version what to use,
but you should find all that from the url I gave.
2. Can I leave the date field in one row empty if the date is unknown.
You can enter null date if your column type allows nulls.
3. If I only know the year an event took place, can I enter just the
year.
Not really if you are using the date column. You would have to give a
full date and then for example use extra column to flag that only year
is true.
4. Would it be best if I used varchar for the column


No. varchar instead of date when dates are used is really a pain in the
ass if you are doing fixes for some old programs, never do that please,
things are a lot easier with date.
Jul 20 '05 #2
On Wed, 08 Sep 2004 04:45:10 GMT, Aggro <sp**********@y ahoo.com>
wrote:
Patricia May wrote:
1. Can I use dd-mm-yy, my website is Australian


Thanks for your advice, I have checked out the page below and I find
it confusing, however I will learn ....

Patricia May
This page will propably answer many to your questions:
http://dev.mysql.com/doc/mysql/en/Da...functions.html


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2665
by: Marek Kotowski | last post by:
I need to put current date into additional column title. I mean something like this SELECT Name_1, ' ' AS CURDATE() FROM Table_1 ... or, better SELECT Name_1, ' ' AS CONCAT('My column ', CURDATE()) FROM Table_1 ... But it doesn't work. AS seems to take only single strings. Is there any solution?
4
3242
by: Michael Hill | last post by:
I am having a problem formatting the third column. It should be 70px wide, but it is extending well beyond 70. The 2nd and 3rd column should be the same width. The content of the 3rd column wraps like it is suppose to, but the width does not get fixed at 70px. <table border="1"> <tr> <td>
2
6780
by: Dman | last post by:
Having trouble in Access XP. I want to display the customers name, city and phone number in a Combo Box but the but the formatting is lost – eg (123) 456-7890 is displayed as 1234567890. Any idea how to format the control. From what I can see, the combo box has a format option but I am referring to the 3rd column. The results display properly within the underlying query… it’s the Combo Box that loses the formatting. Thoughts? ...
3
4077
by: McNutt Consulting | last post by:
I'm trying to implement a datagrid with dynamically created columns. The data is coming out of a very simple XML file, and it's bound through a dataview. The datagrid is just a shell definition with no column definitions in the ..aspx file. The grid is binding fine with all the data being displayed, but my numeric columns aren't being formatted. I'm using the "dataformattextstring", but it doesn't seem to be working. Is there...
5
4564
by: cwbp17 | last post by:
Hi all, Have a datagrid that displays the price column of a table. Went to the Datagrid's Property builder and set the 'Data Formatting expression' for the PRICE column to {0:c}, so that the dollar sign, the comma, and the decimal are included (i.e. $44,644.48) Managed to update the price column of the datagrid back to the database, as long as, the user doesn't delete the dollar sign (in the 0 position).
2
1252
by: msnews | last post by:
Hi All, I have the following code ---------------------------------------------------- Business.Product pdt = new Business.Product(); SqlDataReader product = pdt.GetProductDeals(134); StringBuilder maker = new StringBuilder(); while (product.Read())
1
1707
by: Michael Calvin | last post by:
Some basic things I cannot figure out how to do with new datagrid. 1) How do I control the formatting of the column header separately from the rest of the column? 2) If I align right the column, the header text gets jammed to the right almost so you cannot read the last letter... how do I pad the cell? 3) Cell padding in general?
1
1045
by: benis.ong | last post by:
I have a gridview whose rowupdate, rowediting, rowcreated, rowcancelingedit commands are all written programmatically. Im trying to keep the columns in this grid view consistent by formatting the cells in the rowcreated event. My main problem is that the table cells are not picking up this formatting. THe worst is when i enter the edit mode and have null values in some of the editable cells. The text boxes that are autogenerated seem...
5
21467
by: bob | last post by:
Now this ought to be a simple matter. But nothing's simple in the Net world, I'm finding. In vb6 you could use "!" to force text to upper case in the format function. I've searched the vb.net help system and can't find any help on formatting text. There's plenty of help formatting numbers, dates, and times, though. I'm in the phase of converting from 6 to Net and it seems that even the simplest thing is very, very complicated. And it...
4
1856
by: Keith G Hicks | last post by:
I have a gridview (asp.net 2.0) where I'm trying to format rows based on a NON VISIBLE column. It doesn't seem to work. When column 0 below is visible, the row is formatted as expected but when it's not, it doesn't do anything. How can I do this so that the formatting is based on the value of a non-visible column? If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.Cells(0).Text = "1" Then e.Row.Font.Bold = True...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.