EdgarsK Posted October 2, 2009 Report Share Posted October 2, 2009 Sveiki, vēlos uzzināt vai javascript new Date(); būtu tas pats kas php time(); ? Quote Link to comment Share on other sites More sharing options...
0 Kaklz Posted October 2, 2009 Report Share Posted October 2, 2009 Ne gluži new Date() js atgriež objektu ar kuru tu vari izveikt visādas manipulācijas, noformēt datumus, mainīt datumus uz priekšu atpakaļ,utt. time() tev atgriež vien UNIX timestamp integer formā un neko vairāk. Quote Link to comment Share on other sites More sharing options...
0 EdgarsK Posted October 2, 2009 Author Report Share Posted October 2, 2009 hm.. Kā man norādīt js formātā php time() ? <?php $date=time(); ?> var myDate=new Date(); Teiksim ja mans $date = "mktime(10,11,0,5,15,2009)" ? (15. maijs 2009 / 10:11:00) Quote Link to comment Share on other sites More sharing options...
0 marcis Posted October 2, 2009 Report Share Posted October 2, 2009 Tu gribi ar javascript dabūt timestamp'u? var mydate = new Date(); alert(mydate.getTime()); Quote Link to comment Share on other sites More sharing options...
0 EdgarsK Posted October 2, 2009 Author Report Share Posted October 2, 2009 bet ja man ir savs timestamp ? teiksim time()+$mystamp; ? Quote Link to comment Share on other sites More sharing options...
0 EdgarsK Posted October 2, 2009 Author Report Share Posted October 2, 2009 Vienvārdsakot, veidoju countdown pulkstenīti, bet tur vajag ievietot Date() veidā, bet man ir tikai php $time zem kura ir manis sagatavots timestamp ar laiku kurs nav "šī brīža laiks" Quote Link to comment Share on other sites More sharing options...
0 marcis Posted October 2, 2009 Report Share Posted October 2, 2009 Uztaisi, ka nevajag lietot Date objektu vispār :) Man šķiet, ka šajā forumā arī esmu visādus piemērus rakstījis par šo tēmu.. Quote Link to comment Share on other sites More sharing options...
0 xPtv45z Posted October 2, 2009 Report Share Posted October 2, 2009 Var tā var start = new Date(); start.setHours(13,30,0);start.setYear(2009,9,2); Var arī tā var start = new Date(2009,9,2,13,30,0); Quote Link to comment Share on other sites More sharing options...
0 briedis Posted October 2, 2009 Report Share Posted October 2, 2009 Ņem vērā, ka JS ņem laiku no lietotāja datora, nevis no servera... Quote Link to comment Share on other sites More sharing options...
0 marcis Posted October 2, 2009 Report Share Posted October 2, 2009 Ja tiek norādīts konkrēts datums, tad tiek lietots šis datums, nevis kāds cits. Quote Link to comment Share on other sites More sharing options...
Question
EdgarsK
Sveiki,
vēlos uzzināt vai javascript new Date(); būtu tas pats kas php time(); ?
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.