Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
vremenske zone

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
nel`chee



Joined: 08 Jul 2004
Posts: 2087
Location: Rijeka

PostPosted: 04.07.2006 19:54    Post subject: vremenske zone Add user to your forum ignore list Reply with quote

zanima me kako preoblikovati ovaj red, da bi na vrijeme iz baze dodala +6 sati
Code:
$when = date( "d.m.Y \u H:i", strtotime($myrow['time']));


hvala.
Back to top
View user's profile Send private message Visit poster's website Twitter profile
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 04.07.2006 21:12    Post subject: Add user to your forum ignore list Reply with quote

Code:
$when = date( "d.m.Y \u H:i", strtotime($myrow['time'])+6*60*60);


Confused

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 04.07.2006 21:19    Post subject: Add user to your forum ignore list Reply with quote

dodaj na strtotime() 6*60*60

btw. ako radis nesto sa timezonama, ima PHP bolja rjesenja od ovoga za to
http://www.php.net/manual/en/function.date-default-timezone-get.php

itd..

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 04.07.2006 21:22    Post subject: Add user to your forum ignore list Reply with quote

kasnim

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 04.07.2006 21:26    Post subject: Add user to your forum ignore list Reply with quote

vidim da vadiš time iz baze kao string i onda ga pretvaraš u integer, da bi nakon toga opet posao string

zašto odmah ne izvučeš integer (UNIX timestamp) is baze?

Code:
"SELECT UNIX_TIMESTAMP(time) AS time FROM ..."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nel`chee



Joined: 08 Jul 2004
Posts: 2087
Location: Rijeka

PostPosted: 04.07.2006 21:52    Post subject: Add user to your forum ignore list Reply with quote

ne vadim samo vrijeme iz baze nego cijeli red, pa je ovo ipak krace.

@unique i carr: to sa dodavanjem sekundi sam pokusavala ali na string umjesto timestampa zato mi nije radilo... poslije sam se sjetila, ali tad mi komp nije bio blizu.. eh Smile hvala
ovo za timezone_get sam gledala ali mi nije bas bilo jasno kako da to upotrijebim.
Back to top
View user's profile Send private message Visit poster's website Twitter profile
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 04.07.2006 22:00    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
vidim da vadiš time iz baze kao string i onda ga pretvaraš u integer, da bi nakon toga opet posao string

zašto odmah ne izvučeš integer (UNIX timestamp) is baze?

Code:
"SELECT UNIX_TIMESTAMP(time) AS time FROM ..."


e to! Smile al sad je kasno, a nije mi se dalo ic gledat u mysql manual za takvu nekakvu funkciju Very Happy

btw. jel bolje onda spremat u tablicu kao time tip ili npr. 32bit unsigned int i u njega trpat time() ? jel mozda mysql vise voli svoj poznati tip Confused al kolko vidim postoji dosta mysql funkcija za unix timestamp....

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
nel`chee



Joined: 08 Jul 2004
Posts: 2087
Location: Rijeka

PostPosted: 04.07.2006 22:47    Post subject: Add user to your forum ignore list Reply with quote

hmmm nisam puno razmisljala o tome jer mi nije neki big dil, samo sam kao tip odabrala TIMESTAMP i kao default CURRENT_TIME pa neka on sam bira kako ce spremiti..
Back to top
View user's profile Send private message Visit poster's website Twitter profile
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 05.07.2006 00:36    Post subject: Add user to your forum ignore list Reply with quote

nel`chee wrote:
ne vadim samo vrijeme iz baze nego cijeli red, pa je ovo ipak krace.

Code:
SELECT *, UNIX_TIMESTAMP(time) AS time FROM ..

pa ces imati cijeli row + vrijeme

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 05.07.2006 11:50    Post subject: Add user to your forum ignore list Reply with quote

unique wrote:
btw. jel bolje onda spremat u tablicu kao time tip ili npr. 32bit unsigned int i u njega trpat time()

treba uvijek koristit DATE, DATETIME ili TIMESTAMP (ovisno o potrebi)

@carr: ne znam čitaš li The Daily WTF (trebao bi!) ali ovo mi je jedan od boljih:
http://thedailywtf.com/forums/thread/75982.aspx

Sjetio sam ga se jer je ontopic Smile totalno trganje

Last edited by Sulien on 05.07.2006 12:02; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 05.07.2006 11:57    Post subject: Add user to your forum ignore list Reply with quote

[quote="Sulien"]
unique wrote:
Sulien wrote:
btw. jel bolje onda spremat u tablicu kao time tip ili npr. 32bit unsigned int i u njega trpat time()

treba uvijek koristit DATE, DATETIME ili TIMESTAMP (ovisno o potrebi)


a zasto Smile

btw. nauci se quotat RazzRazzRazz Laughing

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 05.07.2006 12:03    Post subject: Add user to your forum ignore list Reply with quote

nauči se i ti Razz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 05.07.2006 12:35    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
nauči se i ti Razz

Wink

btw. sta ovdje ne valja, javlja syntax error u liniji 3
Code:
CREATE TABLE network_address (
   user_id MEDIUMINT UNSIGNED NOT NULL,
   ip_addr   INT UNSIGNED NOT NULL,
   mac_addr BIGINT UNSIGNED NOT NULL DEFAULT 0,
   INDEX USING BTREE (user_id,ip_addr,mac_addr),
   FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE
) ENGINE=InnoDB;


edit: promjenio sam addr u address i sad je ok Shocked

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 05.07.2006 14:26    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
@carr: ne znam čitaš li The Daily WTF (trebao bi!) ali ovo mi je jedan od boljih:
http://thedailywtf.com/forums/thread/75982.aspx

ne čitam, ali je ovo provala
Quote:
Apparently nobody sees the real value of this solution.
Let's say you ask a customer when he will pay and his answer is "when hell freezes over" .
In a normal database, all you can do is entering "31.12.2199" or null or some other magical value.
This system allows to enter a row into dates_tb with DateDesc="when hell freezes over" and DateDate=null until you find out when hell will freeze over.

a nije da nije primjenjivo na hrvatsko trziste Smile

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group