Jump to content

Recommended Posts

Friends,

 

I asked my freelancer to convert the date in my raw data (Bulletin Date : 18/09/2015) to be as 18-sep-2015

 

But later i found out that the application which will read this DB (using ODBC) requires date to be a TIMESTAMP format.

$text = file_get_contents($name);
$date = getbetween($text, "Bulletin Date : ", "\n");
$date = substr($date, 0, 11);
$date = explode("/", $date);
$date = $date[0] . "-" . $date[1] . "-" . $date[2];
$date = date_create($date);
$date = date_format($date, "d-M-Y");

Now, I do not have the freelancer working anymore and I am so Stuck.

 

I have now two questions:

 

1) What changes to be done in above code so the date becomes in TIMESTAMP format?

 

2) Also, what datatype should i setup for DATE field using PHPMYADMIN?

 

Please any help?

 

Thanks

Natasha

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/300120-timestamp-datatype-in-mysql-db/
Share on other sites

1) why yyyy-mm-dd? Is it a timestamp format? then where is TIme?

 

Is it really so hard to google for the MySQL manual?

 

Date and time literals

 

 

 

2) Also why DATE datatype in MysqlDB? There is already a TIMESTAMP type datatype in MYSQL is that not the right datatype?

 

You specifically asked for a date type, and that's what DATE is for. Using a timestamp when there's no time doesn't make sense.

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.