|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
date Select query
i am using the code
$date = time(); and then insert into mysql db as $sql="INSERT INTO frm_main(name, description, creationDate) VALUES ('$name','$description','$date')"; the creation_date field is int(10) Now i need to convert this date value from some number say,1081936530 to a valid date in the SELECT query itself before the result is selected Pls Help |
|
#2
|
|||
|
|||
|
RE: date Select query
Whats stopping you from setting up creation_date field as DATETIME type?? It will then be easy for Date/Time Calculations + use of Date/Time functions within the SQL statement...
|
|
#3
|
|||||
|
|||||
|
RE: date Select query
Looks like you are storing the timestamp in a integer field. Why don't you use TIMESTAMP field. if you really want to work with timestamp instead of actual dates?
Anyway, this is the way to convert a timestamp to valid date format inside a sql statement. Just check this example: In the same manner, you can grab any part of the date: php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > date Select query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|