Sponsored Content
Top Forums Shell Programming and Scripting Converting timestamps to UTC in bash Post 302294218 by JerryHone on Wednesday 4th of March 2009 07:10:36 PM
Old 03-04-2009
Use Perl's Time::Local module. This has 2 functions you can use...
  • timelocal will convert a local date/time into number of seconds into the epoch
  • gmtime will convert the number of seconds into the epoch into a formatted date/time in GMT, alias UTC
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting bash script to csh

Hi, I'm a beginner in scripting and I recently wrote a bash script that would've worked fine until I realized it needed to be written in csh. Could someone please show me how to correctly change the syntax from bash to csh in this script? Any help will be greatly appreciated. I can provide more... (4 Replies)
Discussion started by: Kweekwom
4 Replies

2. UNIX for Dummies Questions & Answers

Converting bash shell to perl

Does anyone know how to convert this bash shell script to perl? for i in `ls -l *pgp` do `usr/bin/gpg --passphrase-fd 0 $i < .sunspot` done Thanks! Any help would be appreciated. I'm new to Linux and perl. (4 Replies)
Discussion started by: freak
4 Replies

3. Shell Programming and Scripting

how to converting rows to columns, bash

I have in file these words: @fraza1 = rw @fraza2 = r @fraza3 = r @fraza4 = r @fraza5 = r @fraza1 = r @fraza6 = r @fraza7 = r @fraza2 = r @fraza8 = r @fraza9 = r ... I would like so that: ,rw,@fraza1 ,r,@fraza2 (2 Replies)
Discussion started by: patrykxes
2 Replies

4. Shell Programming and Scripting

Bash script to copy timestamps of multiple files

Hi, I have a bunch of media files in a directory that have been converted (from MTS to MOV format), so my directory contains something like this: clip1.mts clip1.mov clip2.mts clip2.mov The problem is that the .mov files that have been created have the timestamps of the conversion task,... (2 Replies)
Discussion started by: Krakus
2 Replies

5. Shell Programming and Scripting

converting ksh to bash - typeset commands

Hi all, Am trying to convert a script written in ksh to a bash shell. At the moment, am stumped with the typeset -u command and I can't find an equivalent of it in bash. integer function is also not working as is the following if statement if ] && ]; then continue fi Is... (3 Replies)
Discussion started by: newbie_01
3 Replies

6. Shell Programming and Scripting

Converting date/time and generating offsets in bash script

Hi all, I need a script to do some date/time conversion. It should take as an input a particular time. It should then generates a series of offsets, in both hour:minute form and number of milliseconds elapsed. For 03:00, for example, it should give back 04:02:07 (3727000ms*) 05:04:14... (2 Replies)
Discussion started by: emdan
2 Replies

7. Shell Programming and Scripting

Converting from Linux bash (GNU) to Solaris script syntax errors

Original script written on CentOS 6.3 with GNU bash 4.1.2 Destination system is Solaris 9 with GNU bash 2.05 (not changeable by me) I have a script written on the linux side but now we need to provide a version to another site that "doesn't like linux". I've been going through changing the ] or... (13 Replies)
Discussion started by: oly_r
13 Replies

8. Shell Programming and Scripting

Converting awk script from bash to csh

I have the following script set up and working properly in bash. It basically copies a set of lines which match "AS1100002" from one file and replaces the same lines in another file. awk -vN=AS1100002* 'NR==FNR { if($1 ~ N)K=$0; next } { if($1 in K) $0=K; print }' $datadir/file1... (7 Replies)
Discussion started by: ncwxpanther
7 Replies

9. Shell Programming and Scripting

Converting macro to bash script

Gents, Please can you help me with this. When column 49 == 2 Before X 4714 14710 69445.00 19257.001 1218 12271 69596.00 19460.00 19478.001 X 4714 14710 69445.00 19257.001 1228 12292 69596.00 19480.00 19480.001 After X 4714 14710 69445.00 19257.001 1218... (1 Reply)
Discussion started by: jiam912
1 Replies

10. Shell Programming and Scripting

Converting timestamp from PST to UTC

I need to convert the given datetime from PST to UTC, i gone through multiple forum examples but everywhere it mentioned about converting the server datetime. So could someone help me on this. I will be getting arguments for my script in the format of yyyymmddhh (eg:2015101004 - it will be pst),... (4 Replies)
Discussion started by: close2jay
4 Replies
timezone(5)							File Formats Manual						       timezone(5)

NAME
timezone, dst - difference between Universal (Greenwich mean) time and Local time VALUES
Default A default value of indicates that the default value for the timezone tunable (420 minutes west of Greenwich, England ) is to be interpreted as a daylight savings time value. Allowed values The value for the tunable should correspond to a defined time zone, and thus should be at least a multiple of 15 minutes. More commonly the value will be a multiple of 60 or 30 minutes, corresponding to an hour or half-hour time zone. The value of the tunable specifies if the time is with daylight savings or not. When the value is set to then the system is using daylight savings time, and if it is set to the system is not. Recommended values Any allowed value is equally recommended. However, the chosen value should correspond to the time zone and daylight saving scheme of the system site or to a time zone and daylight saving scheme which has meaning for applications or users. DESCRIPTION
The tunable is the difference between Greenwich mean time (Universal Time) and local time, expressed as minutes west of Greenwich, England. The tunable indicates whether the tunable is to be interpreted as a standard or daylight savings time value. These tunables provide a way to convert between Grenwich Mean Time (or Universal Time) and local time. Although is a tunable, it is not used to affect the behavior of the system. Rather, it is used to remember time zone information when the system is rebooted. This infor- mation is returned by under HP-UX extensions. The tunable is independent of other methods of indicating time zones. For example, gets or sets the time in either Universal or local time by using the environment variable. In this case the tunable has no effect. In general, it is best to refer to the manpages for specific system calls such as and to check if there is a dependency on the tunable. Who Is Expected to Change This Tunable? Anyone. Restrictions on Changing Changes to these tunables take effect at the next reboot. When Should the Value of This Tunable Be Changed? These tunables may be changed to match the system's geographic time zone or the time zone of users. What Other Tunable Values Should Be Changed at the Same Time? The and tunables should always be set and interpreted as a pair of values. WARNINGS
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its meaning changed in future releases of HP-UX. Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parameter values. After installation, some tunable parameters may no longer be at the default or recommended values. For information about the effects of installation on tun- able values, consult the documentation for the kernel software being installed. For information about optional kernel software that was factory installed on your system, see at AUTHOR
and were developed by HP. Tunable Kernel Parameters timezone(5)
All times are GMT -4. The time now is 04:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy