472,373 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

setting local time without restarting server

Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...

Thanks,
Peter
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
4 4709
On Thu, May 13, 2004 at 12:56:48 -0600,
Anony Mous <A.****@shaw.ca> wrote:
Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...


You probably want to set the timezone, not the local time.
You can do that with something like:
SET TIMEZONE='EST5EDT';

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Thanks, but I do want to set the system time.

It's actually for testing purposes. Our software looks to the db server to
obtain the local date and time, however, to test various cases we need to
fiddle with this value. I'd like to do it without having to first change
the system time, and then re-start the postmaster. Sorry, I should have
clarified this in my first e-mail.

-Peter

-----Original Message-----
From: Bruno Wolff III [mailto:br***@wolff.to]
Sent: May 13, 2004 2:07 PM
To: Anony Mous
Cc: pg***********@postgresql.org
Subject: Re: [GENERAL] setting local time without restarting server

On Thu, May 13, 2004 at 12:56:48 -0600,
Anony Mous <A.****@shaw.ca> wrote:
Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...


You probably want to set the timezone, not the local time.
You can do that with something like:
SET TIMEZONE='EST5EDT';
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
On Thu, May 13, 2004 at 15:07:13 -0500,
Bruno Wolff III <br***@wolff.to> wrote:
On Thu, May 13, 2004 at 12:56:48 -0600,
Anony Mous <A.****@shaw.ca> wrote:
Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...


You probably want to set the timezone, not the local time.
You can do that with something like:
SET TIMEZONE='EST5EDT';


Thinking about this some more; this only changes it for the session not
the default for new sessions.

Reading the documentation suggests that you can set the timezone in the
config file and sighup the postmaster to get it to reread the config file.
It might also be possible to change the underlying system's timezone
and do a sighup to have it pick up the correct timezone.

If the underlying system has the correct timezone, but for some reason has
the wrong time, you should be able to change its time. How you do that
varies a bit from system to system. Under *nix systems you usually use
the 'date' command (if you aren't using ntp). Under Linux, at least,
you also want to run setclock to set the hardware clock to the right
time so the time is still correct after the next reboot.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #4
Anony Mous <A.****@shaw.ca> writes:
Thanks, but I do want to set the system time.
You cannot do that from within Postgres, because it requires root
privileges.
I'd like to do it without having to first change
the system time, and then re-start the postmaster.


Who said anything about restarting the postmaster? Just set the system
time (eg, with date(1)).

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Harag | last post by:
Hi all I think this is in the wrong group but since I don't read others much or code in java script I was wondering if anyone could help me with this small problem, as I code mostly in ASP...
0
by: pwldev | last post by:
Sorry if this isn't a good place for this question. I have a problem with losing cookie values whenever a user's local machine date/time is behind the date & time of the IIS machine. The login...
4
by: Elie Grouchko | last post by:
Hi All 1. I need to convert the local-time of the server on which I run my website to UTC and I don't want to rely on the server local time and timezone (i.e. I don't want to hardcode the...
1
by: thomasamillergoogle | last post by:
Hello, My sql server 2000 database is on a shared server that I have absolutely no control over. When i run query select getdate() it is reporting the wrong time! I am pretty sure that the...
0
by: Bill Borg | last post by:
Hello all, I need to know the local time for users of a global system. Here's the scenario: My server (PDT time) hosts commerce for companies around the world. It's fair to assume that those...
5
by: rgrandidier | last post by:
I have a SQL table that stores the UTC time for a column, I then want to display the UTC time to the user in their local time. My approach is to have the user set their time zone via their user...
3
by: Si Chen | last post by:
Hello. It seems that every time I make a change to pg_hba.conf, I have to restart the database server for the new authentication to take effect. Is there a way to have the server use the new...
3
by: Randall Parker | last post by:
Suppose one has a database of UTC times that are from different dates in the past. The problem with translating those times to a local time is that one does not know for each UTC time whether the...
2
by: blast8180 | last post by:
I'm completely new to asp, coding, and scripting. I have a business background so I'm not familiar with this world at all. That said, I'd like some help on clarifying what this article is asking of...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.