Column formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patricia May

    #1

    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


  • Aggro

    #2
    Re: Column formatting

    Patricia May wrote:
    [color=blue]
    > 1. Can I use dd-mm-yy, my website is Australian[/color]

    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.
    [color=blue]
    > 2. Can I leave the date field in one row empty if the date is unknown.[/color]

    You can enter null date if your column type allows nulls.
    [color=blue]
    > 3. If I only know the year an event took place, can I enter just the
    > year.[/color]

    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.
    [color=blue]
    > 4. Would it be best if I used varchar for the column[/color]

    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.

    Comment

    • Patricia May

      #3
      Re: Column formatting

      On Wed, 08 Sep 2004 04:45:10 GMT, Aggro <spammerdream@y ahoo.com>
      wrote:
      [color=blue]
      >Patricia May wrote:
      >[color=green]
      >> 1. Can I use dd-mm-yy, my website is Australian[/color]
      >[/color]

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

      Patricia May
      [color=blue]
      >This page will propably answer many to your questions:
      >http://dev.mysql.com/doc/mysql/en/Da...functions.html
      >[/color]

      Comment

      Working...