Forum Moderators: coopster

Message Too Old, No Replies

time date conversion

Date Time

         

Saint Honore

1:28 pm on Sep 14, 2006 (gmt 0)

10+ Year Member



Hello,
I have a field called start with int date type which stores date into 8 digit character, i want to get that 8 digits into proper date format like Y-m-d format

Please help

adb64

2:09 pm on Sep 14, 2006 (gmt 0)

10+ Year Member



Use the PHP date [nl2.php.net] function.
Example:

$YmdStr = date("Y-m-d",$Start);

In which $Start contains your 8 digit value, most likely it is a Unix timestamp in which case the date function understands it and can convert it into a string based on the format string.

Saint Honore

4:19 pm on Sep 14, 2006 (gmt 0)

10+ Year Member



Hello,

Thanks for the prompt and swift response.
I think i have not explained my sitaution properly. Here is my situation, I have a field in DB called “start” which is of data type int which stores 10 digit numbers.
Now I have a search form where I enter the text like this Y-m-d = 2006-11-23 after entering the date it should be able to convert the search text to 10 digit numbers where I can search for the record in DB.

adb64

1:44 pm on Sep 15, 2006 (gmt 0)

10+ Year Member



Hi, sorry for my late response.

So you want the other way around,
in that case you can use the strtotime [php.net] function.