Loading
Showing posts with label Time. Show all posts
Showing posts with label Time. Show all posts

Monday, October 5, 2009

Set Time Zone From Command Line in Windows 2003, XP and 2000

Quick and easy way to set timezone from command line in Windows 2003, XP and 2000.
CONTROL.EXE TIMEDATE.CPL,,/Z Eastern Standard Time
CONTROL.EXE TIMEDATE.CPL,,/Z Central Standard Time
CONTROL.EXE TIMEDATE.CPL,,/Z Mountain Standard Time
CONTROL.EXE TIMEDATE.CPL,,/Z Pacific Standard Time
These are a little longer but they do the same thing.
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Eastern Standard Time
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Central Standard Time
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Mountain Standard Time
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Pacific Standard Time
See also Set Time Zone From Command Line in Windows 7 and Windows 2008

Keywords:
change time zone from command line windows xp
windows 2003 change timezone
command to get time zone in win xp

Windows 7 (and Windows 2008) Command Line Utility to Change Time Zone

Here is a great hidden command line utility which is available starting in Windows 7, "tzutil.exe," which can be used to view or change the computer's Time Zone. To use this command:

1. Open the Command Prompt.
2. Enter any of following commands:
tzutil /g (To view current time zone)
tzutil /l (To get a list of all available time zones)
tzutil /s time_zone_ID (To change time zone)
time_zone_ID is the new time zone you want to set. Fox example, if you want to set the time zone to "Eastern Standard Time", then the command would be:
tzutil /s "Eastern Standard Time"
See also Set Time Zone From Command Line in Windows 2003, XP and 2000

Thursday, September 3, 2009

SQL: How to extract Year, Month, Day, Hour, Minute and Seconds from a DateTime

The DATEPART function accepts two parameters :

DATEPART ( datepart , date ) where
datepart - specifies the part of the date to return. For eg: year, month and so on
date - is the datetime or smalldatetime value

QUERY

SELECT
DATEPART(year, GETDATE()) as 'Year',
DATEPART(month,GETDATE()) as 'Month',
DATEPART(day,GETDATE()) as 'Day',
DATEPART(week,GETDATE()) as 'Week',
DATEPART(hour,GETDATE()) as 'Hour',
DATEPART(minute,GETDATE()) as 'Minute',
DATEPART(second,GETDATE()) as 'Seconds',
DATEPART(millisecond,GETDATE()) as 'MilliSeconds'

Note: When using a smalldatetime, only information up to the 'minute' gets displayed. Seconds and milliseconds are always 0.

Tuesday, September 1, 2009

SQL SERVER – Get Time in Hour:Minute Format from a Datetime – Get Date Part Only from Datetime

Get Current Date & Time
select GetDate()

SQL Server 2000/2005
SELECT
CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond,
CONVERT(VARCHAR(8),GETDATE(),101) AS DateOnly
GO

SQL Server 2008

SELECT
CONVERT(TIME,GETDATE()) AS HourMinuteSecond,
CONVERT(DATE,GETDATE(),101) AS DateOnly
GO

Manually sync clock on Ubuntu Linux

You may manually sync the clock using the following

sudo ntpdate servername
where servername can be any public or private time server.

Example
sudo ntpdate pool.ntp.org

Monday, August 31, 2009

Windows 7 Command Line Utility for Timezone Management - tzutil.exe

"tzutil.exe" is a command line utility introduced in Windows Vista (also in Windows 7 and Windows 2008) which can be used to change Time Zone or to view the current time zone information. To use this command (from a command prompt as administrator):
tzutil /g - To view current time zone
tzutil /l - To get a list of all available time zones
tzutil /s <time_zone_ID> - To change time zone
time_zone_ID is the new time zone which you want to set. For example, if you want to set the time zone to Eastern, Central, Mountain or Pacific Daylight Time, you would use any of the following:
tzutil /s "Eastern Daylight Time"
tzutil /s "Central Daylight Time"
tzutil /s "Mountain Daylight Time"
tzutil /s "Pacific Daylight Time"
Windows change timezone command.

Set the Time Zone from the command line on Windows computers

To set the Time Zone from the command line, use:

RunDLL32 shell32.dll,Control_RunDLL %SystemRoot%\system32\TIMEDATE.cpl,,/Z

where is the data value of the Display Value Name, or the Std Value Name ,at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\Time Zones\.

You can also use:

Control.exe %SystemRoot%\system32\TIMEDATE.CPL,,/Z .

Example:
RunDLL32 shell32.dll,Control_RunDLL %SystemRoot%\system32\TIMEDATE.cpl,,/Z US Eastern Time

NOTE: You do NOT encapsulate the time zone string in quote (") marks.


See also

Friday, July 24, 2009

Time Windows 2000 SERVER

C:\>net time /querysntp
This computer is not currently configured to use a specific SNTP server.
The command completed successfully.

For a list of NTP servers, see this page. Let's configure it for clock.isc.org:

C:\>net time /setsntp:clock.isc.org
The command completed successfully.


Verify that it stuck:

C:\>net time /querysntp
The current SNTP value is: clock.isc.org
The command completed successfully.

You may need to bounce w32time to see your results:

C:\>net stop w32time
The Windows Time service is stopping.
The Windows Time service was stopped successfully.
C:\>net start w32time
The Windows Time service is starting.
The Windows Time service was started successfully.

Note that you only want to do this on machines that are not already synchronizing with the domain controller, which happens automatically with active directory. This is also the method you would use to select an outside source to synchronize time with on the PDC of the domain at the root of the forest.