leiaah
Apr 16 2005, 01:23 AM
| | Hi this is the code I've been using. This works perfectly fine with mysql but I'm having trouble with getting the exact time. It probably has something to do with time zones and countries. Is there something that I need to set to get the time right? I'm from the Philippines and we have the same time as Singapore and HongKong. Help please. Tnx.
CODE $date = date('H:i A, jS F Y'); |
Reply
beeseven
Apr 16 2005, 02:31 AM
One thing you can do (that I did, and it worked) is to change the offset (actually I think it's the only thing you can do). Figure out what time the server is at with just a simple date showing the hour/minute. Something like: CODE date("H:i") Then, find your time (just look at a clock). Where I am, the difference is 3 hours. Then convert the difference to seconds (hours*3600). To make it change the time in the date function, add this optional parameter: CODE date("H:i",time()+thedifference) OR date("H:i",time()-thedifference) //In the case that you're behind the server, I don't know what timezone you're in You can do a test or two with the other date things to make sure it's right.
Reply
mobious
Apr 16 2005, 11:07 AM
have you ever tried this? CODE gmdate('H:i A, jS F Y', time());
Reply
beeseven
Apr 16 2005, 05:00 PM
QUOTE(mobious @ Apr 16 2005, 06:07 AM) have you ever tried this? CODE gmdate('H:i A, jS F Y', time()); That would just return the server's time, which isn't necessarily the desired time.
Reply
leiaah
Apr 18 2005, 01:01 AM
QUOTE(beeseven @ Apr 16 2005, 10:31 AM) One thing you can do (that I did, and it worked) is to change the offset (actually I think it's the only thing you can do). Figure out what time the server is at with just a simple date showing the hour/minute. Something like: CODE date("H:i") Then, find your time (just look at a clock). Where I am, the difference is 3 hours. Then convert the difference to seconds (hours*3600). To make it change the time in the date function, add this optional parameter: CODE date("H:i",time()+thedifference) OR date("H:i",time()-thedifference) //In the case that you're behind the server, I don't know what timezone you're in You can do a test or two with the other date things to make sure it's right. Thanks beeseven! The time is plus 15 here! Very cool!
Reply
Similar Topics
Keywords : date function php- PHP Function To Add Previous and Next Page Feature
- useful php function (0)
- Getting List Of Directories And Files Using Php
- PHP Function for Directory and File List (6)
is there a php function that lists the content of some folder.... example: /New folder new.txt
left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
style='vertical-align:middle' alt='rolleyes.gif' /> ...
How To Use A Link To Call Function In Php?
- (8)
The title says it all, really. How do you call a function using in PHP? I'm doing a project
and I stumbled upon this problem. I don't want to use query string in the href part like
since that would mess up the other part of my code. Can anyone pleae help me? I've pasted the
code below. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> Thanksh.
CODE <?php function display($x){ //coding goes here. } ?>
<html> <body> <p align="center"> <a href="what g...
Include File.php?id=something
- using the include() function (13)
Well, I am making a full CMS system for my site, and want to make the index.php file to include the
view.php?id=1 file. I tried with this code, but it didn't work: CODE <?php include
'view.php?id=1' ?> This is the error I get: CODE Warning:
main(view.php?id=1) [function.main]: failed to open stream: Invalid argument
in C:\server\xampp\htdocs\test\index.php on line 1 Warning:
main() [function.include]: Failed opening 'view.php?id=1' for inclusion
(i...
How Good Is This Data Cleaning Function?
- (2)
Hi all, this is my first function and as part of a script and i just want to know a couple of
things. here is the code for the function: CODE <? function
clean($dirty_string) { $muddy_string = stripslashes($dirty_string);
$murky_string = strip_tags($muddy_string); $clean_string =
htmlentities($murky_string); }; ?> So the first thing is how secure is
it? the script this will be used in connects to a database and sends an email so it needs to stop
SQL injections and any email ab...
Php Date()?
- timezone is offset (4)
Hi my timezone is GMT and the code im using to display the time and date is this: CODE
date('l j F - g:i a') which would then display "Tuesday 25 March - 12:11 am"
But the time for me at the time was 07:11 am. Anyone know how to tune it so it is with GMT time?...
Endif function?
- (6)
As you get noticed before, I am studying PHP in examples like using the tutorials as well as books
itself. Through my readings, I get this function CODE <?php endif; ?> a lot of times.
So, what do you mean by this function, and what does it do exactly?...
How To Check If Fsockopen Function Is Enabled?
- (2)
Hi, I have VPS (virtual private server) and I have access to php.ini file. Is there any script that
will show that fsockopen function is enabled or where do I have to enable it? Searched google and
here and couldn't find anything. Thanks! ...
Mail() Clone
- A PHP mail() function clone (5)
A lot of free web hosts have disabled the mail() function so you cannot send emails using PHP. Does
anybody know of a script that makes a function "like" mail but is able to be installed in a web
accessible directory and called included into another script and called like that? Or maybe you know
how to make such a function? I just really need to find a way around the free hosts turning of the
mail() function. I need to figure out a way to send emails....
Arrays Outside A Function
- Need to have arrays available to all functions. (3)
I've got a bunch of arrays that i want to use for more then 1 function. when i declear the
arrays outside a function i cant use it in a function. This code was originally written in
javascript by another person but since I plan to use it and extend it with php I had to change it
from javascript to php code. In the javascript code the arrays were decleared outside the functions
with 'var arrayname' I read somewhere that declearing javascript variables with
'var' gives it global access. Any ideas on how I can go about declearing 1 set of these
arrays t...
The Best Zip Function
- (1)
hi my 6th code is very useful, you can zip your file by this: CODE <? class dZip{ var
$filename; var $overwrite; var $zipSignature =
"\x50\x4b\x03\x04"; // local file header signature var
$dirSignature = "\x50\x4b\x01\x02"; // central dir header signature
var $dirSignatureE= "\x50\x4b\x05\x06"; // end of central dir
signature var $files_count = 0; var $fh; Function
dZip($filename, $overwri...
Displaying Date And Time (gmt+8)
- (5)
how to display date and time (gmt+8)? any help would be appreciated....
Php Explode Function Help
- (4)
I am having trouble creating a script, all i want to achieve is to: 1. Select the variable from my
mysql database, which is in a format of : id|id|id|id| and so on... 2. Split them into separate
variables by using : $songexploded = explode("|",$ttyo ); 3. Then this is the bit I'm
stuck on trying to create a while loop from the $songexploded variables. So(this might not be
correct but you should get the idea).. CODE $x=1; while ($songexploded
==$result) echo $songexploded[$x].'<br>'; }...
Php Date() Problem [resolved]
- date() seems to loop same ninute. (4)
My setup is a macbook pro and I have apache+ mysql + php already included I think. the php is
version 4.4.4 I have been using the date() to store dates into my mysql tables in the past and it
worked corectly. I dont know what could of happen but now the date() function is returning an
incorrect time. I made a test script test.php CODE <?php $date_time =
date('y-m-d H:m:s'); echo($date_time); ?> and loaded
it up. My laptops system time would be 1.35.33 PM and the date and time returned from php would be
07-...
[php](simple) Using Functions To Combine Values In A Form
- Really simple example on how to combine values with function (2)
I just learned this simple method on how to use functions to combine two values from a form. First
we create ourselves a simple POST form CODE <form method="POST"> Name:
<input type="text" name="nickname"> Location: <input
type="text" name="location"> <input type="submit"
value="Input"> </form> Now we add this php to that same file CODE
<?php $nick = $_POST['nickname']; $location =
$_POST['location' ...
[php] Header Function
- (2)
Header function Greetings we are going to use the header() funtion to redirect start making a
file called page.php at the top of the file add CODE <?php ?> Example 1 After
CODE header('Location: http://www.trap17.com'); the LOCATION means
where you want it to go. Example 2 you also can define a file that you want to redirect to After
CODE header('Location: index.php'); Example 3 you also can add a timer to
it /laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt=...
Display The Current Date/time
- With a simple PHP code (3)
Use this code to display the current date and time. CODE <?php $date =
date('l dS \of F Y h:i:s A'); echo "$date"; ?>
"l" would display the current day of the week such as Sunday. d displays the day of the month...
such as 1 and S adds the appropriate suffix(st). /of simply displays the word "of". F displays the
current month with no abbreviations while Y displays the four digit year(2007). "h" displays the
current hour with leading zeros if necessary(Ex. 06 for 6 o'clock). "i" displays the m...
The Extract() Function
- Something I just found out (6)
The extract() function is used in PHP to take an array and split it up into variables. MySQL
queries can be parsed this way. Below is an example. CODE $query =
mysql_query("select username, password from users where uid=1"); $result =
mysql_fetch_array($query, mysql_assoc); extract($result); print "Your
username is : $username"; The extract() function works for ANY array, including
$_POST, and $_GET. Makes processing form data a LOT easier /biggrin.gif"
style="vertical-align:midd...
Error With Joomla Template
- cant find function (1)
Hello! I am working on my template in Dreamweaver and i am using joomla extensions for
dreamweaver! When i start my page with joomla stand alone server(jsas) i get this errors on the
bottom of the page! QUOTE Warning:
mosloadcomponent(w:/www/Joomla/components/com_banner/banner.php) : failed to open stream: No such
file or directory in w:\www\Joomla\includes\frontend.php on line 66 Warning:
mosloadcomponent(w:/www/Joomla/components/com_banner/banner.php) : failed to open stream: No such
file or directory in w:\www\Joomla...
Explode Function Help
- need help from you programmers! (1)
/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Hi I am robert I
need some help with some php coding. I am stuck with a explode function. Here is the code:
$username = $check ; $query="SELECT `buildings` FROM `authuser` WHERE
`uname` = '$username'"; $result=mysql_query($query);
$result=mysql_result($result,0);
list($building1,$building2,$building3,$building4,$building5,$building6
,$building7,$building8,$building9,...
Simple Php Calendar And Yahoo! Calendar Connection
- linking each date to Yahoo! calendar (7)
Original simple PHP calendar source here I was looking for a simple PHP generated calendar. But I
wanted to place detailed information to show on demand. And installing another database with
separate management would have been too much of access codes and passwords to remember. And what if
I want someone else to manage the calendar when I am not able? This is my version of using simple
PHP calendar script to link to Yahoo! calendar. The twist is that figuring out how Yahoo!
calendar selection worked. And then depending on which date was clicked it will bring ...
Regexp Function Preg_match_all()
- preg_match_all() - Help me (0)
Hi, I got a new problem which has caused me to go mad but no solution. preg_match_all() - is the
problem. I have something like this: CODE [ol] [li]Test1[/li]
[li]Test2[/li] [li]Test3[/li] [li]Test4[/li]
[li]Test5[/li] [/ol] Some text.Some text.Some text. [ol]
[li]Test1[/li] [ol] [li]Test1[/li]
[li]Test2[/li] [li]Test3[/li] [li]Test4[/li]
[li]Test5[/li] &...
Question About The Mail() Function
- (2)
Hi, Is there any way of using the mail() function with an SMTP connection? Is there any way of
sending messages let's say for example using an email of yahoo? Any help about this woul be very
thankfull. Thanks in advance....
How To Enable Mail() Function In Php
- (1)
im just trying to send mail by using a very simple php function mail() but it is not working.the
format is CODE $to = "email@example.com"; $subject = "Hi!";
$body = "Hi,\n\nHow are you?"; if (mail($to, $subject,
$body)) { echo("<p>Message successfully
sent!</p>"); } else { echo("<p>Message delivery
failed...</p>"); } I think there is something wrong with php.ini
setting..maybe something to do with SMTP ...
Adding One Day To Date
- i'd like to add one day to date (3)
I would like to add one day to date.Doesn't any one have a simple code that I can have. or mabe
a link. date("Y-m-d H:i:s") + (1800 * 24);//this doesnt work ;/ but i need to have 24 hours after
date for a check. Thanks for taking the time i hope some one can help me out. Dont warry about it
if you dont have some thing already made. ...
php header() function help needed
- automatic re-direct (4)
hey ppl, u seem to have real gud knowledge about php, i just wanted a little help...i designed this
website, but i want that if i click on certain page, it should open for some few seconds and then
browser should automatically redirect me to some other page....i tried this with header() function
but i couldnt do the wait n redirect part, ... so somebody plz help.... -thanx in advance!...
Need Help With Php
- GET function with timer (2)
I need some help on creating a timer that every thirty minutes, refreshes on a URL. I know how to
get the page, but I have no idea how to create a timer that initiates it. Could someone point me on
a helpful direction?...
Question For The If And Echo Function
- (2)
I'm not that good with PHP, and I tried this code: CODE if (
$_SERVER['REQUEST_URI'] == ('/') )/*'/' is the
domain root*/ { echo('<img src="{I_ONEURL}" border="0"
alt="{T_SOMETHING}" />'); } else { echo('<img
src="{I_ANOTHERURL}" border="0" alt="{T_SOMETHING}" />'); }
However, it doesn't work. So, basically, I want that if the request is at the root (actually
mysubdomain.domain.com), it will show {I_ONEURL...
Need Help With The Header() Function
- I am redirecting from my old site (2)
Over a month ago, I bought a domain name for my site, but my site is still not indexed. I did
everything needed to get indexed, but I forgot one thing: The old site had exactly the same content
as the new one. So I had duplicate content. Therefore, I want my old site to redirect the user to
the new site with this script: CODE <?php header("Location:
http://www.global-rs.com" . $_SERVER['REQUEST_URI']); exit; ?>
global-rs.com is my new URL. However, on my old site, which I will be placing this code on, there
i...
Sending Attachments Using Email Function In Php
- (2)
I'm trying to send an attachment using the mail Php function. It gets caught by the email
server with an error. It seems to have a problem with the separator or who knows what. The server
says something like "invalid separator on mime type." The code is: Code: CODE // subject
$subject = "Hello There "; $mime_boundary =
"<<<--==-->>>"; // headers $headers =
"From: " . 'Tom' . " <" . 'texample@aol.com' .
">\r\n"; ...
Looking for date, function, php
|
|
Searching Video's for date, function, php
|
advertisement
|
|