Jump to content

date format question


tribal

Recommended Posts

hi, i got a DB field that is a DATETIME format and is automatically entered when a user registers. how do i change format from 2003-10-22 10:05:06

 

to something like 10/22/2003 10:05 ??

 

can i modify the existing mysql format?

Link to comment
Share on other sites

From MySQL manual:

 

MySQL retrieves and displays DATETIME values in \'YYYY-MM-DD HH:MM:SS\' format.

 

I had the same issue and wanted to store the date in mysql in a custom format. I defined the column to be a TEXT instead of DATETIME and populated it with PHP

[php:1:44d99b4a40]<?php

$datetime = date(\"d/m/Y h:i\");

?>[/php:1:44d99b4a40]

 

Hope it helps.

Link to comment
Share on other sites

  • 4 years later...

I was searching the same problem. I would like to change it on output but i can't find any functions that will do that. They only format the time as it is now. I want to take any date from the DATE on mysql and change it to eg. Jan. 11, 2005 .. can anyone help me find a function that will do this, thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.