Date Problem


#1

I am using a MS Access database. When I query the table and extract a date, it is a huge number. How do I convert what I assume is an internal format into a meaningful string that I can display on a PHP web page?


#2

are you talking about the UNIX timestamp? if so then use the date function.


#3

I thought I needed the date function, but can’t seem to get it to work. If I have a variable called $test_date, what would be the EXACT syntax to display this date in a readable format (like “July 10, 2003”). I have tried a bunch of things, but none work.

Thanks from a newbie.


#4

http://www.php.net/manual/en/function.date.php

There are plenty of examples.


#5

I have been to that page, but still have problems. On that page, while there are many examples, but they are all hardcoding a date of “1” ( ex: echo date(“1 dS of F Y h:i:s A”); ). I want to use a variable. How would I do the above example with a variable instead of the hardcoded “1”. For Example, I want to use $start_date instead of 1. I know I am close, because if I hardcode the internal date I am getting from the database, it works.

Thanks again.


#6
string       date ( string format        [, int timestamp])
return               input 1               optional input 2
value

Example:

$dateString = date("Y-m-d", $timestamp); 

#7

THANKS! :D That was EXACTLY what I needed. SOmetimes I just don’t understand what the tech pages at PHP say. You have been a BIG help!