The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
changing date manoj.solaris Linux 1 09-12-2007 05:27 PM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 07:15 AM
changing the format of date nasirgondal Post Here to Contact Site Administrators and Moderators 1 06-08-2006 02:37 AM
Linux sys date changing nikk UNIX for Advanced & Expert Users 1 06-23-2002 09:19 PM
changing the date JBX UNIX for Dummies Questions & Answers 2 09-13-2001 09:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-14-2006
shiroh_1982
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Changing the date to EST

Hi,

The unix box has a system date in the PDT time zone format..if i need to capture the value of the date in a variable id do this:
orderdate=`date '+%Y%m%d'`
ordertime=`date '+%H%M%S'`

output :
$orderdate= 20060714
$ordertime= 043438

I need to convert and store this orderdate and ordertime to EST format.Is there any functions that let me get the EST timezone value instead of jst adding 3 hours???
  #2 (permalink)  
Old 07-14-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,773
The environment variable TZ can be used to change the timezone temporarily
I'm assuming you are in the Pacific timezone (TZ="PST8PDT") in this code snippet:
Code:
#!/bin/ksh
oldTZ="$TZ"
export TZ="EST5EDT"
orderdate=`date '+%Y%m%d'`
ordertime=`date '+%H%M%S'`
export TZ="$oldTZ"
  #3 (permalink)  
Old 07-17-2006
shiroh_1982
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
thanks worked perfectly
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0