I need help with formatting date from mysql! with php!


Posted on 16th Feb 2014 07:03 pm by admin

Hello guys

*Note: this is a php question not MySQL question, please do not move it to mysql section! Thank you.

Did you know?Explore Trending and Topic pages for more stories like this.
anyway, I have a record from the database as 2009-12-31 23:59:59

I needed to when ever I pull that record, I need to change it to mktime() format, so I can do so many things with it.
I tried to change it through preg_replace!



$str = "2009-10-13 11:30:15"; // an example only of the format data pulled from the DB!
$pat = '/(d{4})-(d{2})-(d{2}) (d{2}):(d{2}):(d{2})/';
$replace = 'mktime(4 ,5 ,6 ,2 ,3 ,1)';
echo preg_replace($pat, $replace, $str); // which give me the exact string of mktime(#,#,#,#,#,#)!


Please help me out!

Thank
No comments posted yet

Your Answer:

Login to answer
238 Like 7 Dislike
Previous forums Next forums
Other forums

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

Accessing Infotype data in dialog program
Hi All
In Dialog programs attributes I didn't see any logical database field. How can I access

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

IMAGE - SERVER SIDE scripting help...
How to receive pixel data of an image and buid a bitmap file on the server using the HTTP POST metho

upload image name with extension using php
hi frds..

<input id="file1" type="file" name="file[]" &a

Sort a two dimensional array.
Hi. I've set up a two dimensional array that reads as follows:

Code: $modifiedData = array(

Create or replace package is ending ORA-21700
Database 9.2.0., patch 8 (9.2.0.8.0).
I trying run
create or replace package ....etc.

Problem executing bash script using shell_exec
Hi there,
I created a bash script file using following code to convert doc documents to pdf using

Sendmail.php - heading error following check_input
Hi,

I would greatly appreciate some help? I am brand new to PHP and have been searching and e

Return X values where an ID number doesnt matter
Well as for subject heading, thats the best i could think of.

Currently im having a problem w

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash