Конвертиране на време от unix в човешки вид.

index

Super Moderator
Здравейте,
имам малко нужда от помощ. Ето за какво иде реч.
Трябва ми от базата данни времето да се конвертира от unix time в човешки вид и обратното(18/08/1999 примерно).
Трябва ми с JS , ajax , jquery или с каквото и да е.

Unix time(не се вижда) -> човешки вид ( вижда се от потребителя ) - > unix time (не се вижда)


Надявам се ,че съм съомял да го обясня.
 
Ето ти с php как да го оправиш:

$unixtimestamp = 121868622862; //какъвто ти е unixtimestamp-a

date('d/m/Y', $unixtimestamp); /*това ти го превръща в каквото ти трябва*/

За подробности относно date() функцията прочети тук

След като го прочетеш ще видиш как най-добре те устройва да се показва датата.

Успех!
 
d3xter каза:
Ето ти с php как да го оправиш:

$unixtimestamp = 121868622862; //какъвто ти е unixtimestamp-a

date('d/m/Y', $unixtimestamp); /*това ти го превръща в каквото ти трябва*/

За подробности относно date() функцията прочети тук

След като го прочетеш ще видиш как най-добре те устройва да се показва датата.

Успех!
Благодаря ти много за полезната информация , но това не ми върши работа.Поне за момента. Не ми трябва да е с PHP, Perl , Pyton .... C+.....
Искам го с js , jquery или някакъв подобен скрип..... да не е вървърен а браузерен.
 
To convert the current date and time to a UNIX timestamp do the following:

var ts = Math.round(new Date().getTime() / 1000);

getTime() returns milliseconds from the UNIX epoch, so divide it by 1000 to get the seconds representation. It is rounded using Math.round() to make it a whole number. The "ts" variable now has the UNIX timestamp for the current date and time relevent to the user's web browser.

http://www.epochconverter.com/

http://stackoverflow.com/questions/847185/convert-a-unix-timestamp-to-time-in-javascript
 
emagi каза:
To convert the current date and time to a UNIX timestamp do the following:

var ts = Math.round(new Date().getTime() / 1000);

getTime() returns milliseconds from the UNIX epoch, so divide it by 1000 to get the seconds representation. It is rounded using Math.round() to make it a whole number. The "ts" variable now has the UNIX timestamp for the current date and time relevent to the user's web browser.

http://www.epochconverter.com/

http://stackoverflow.com/questions/847185/convert-a-unix-timestamp-to-time-in-javascript
10x
 

Back
Горе