Sponsored Content
Top Forums Shell Programming and Scripting How to generate datetime string? Post 302534592 by buechler66 on Tuesday 28th of June 2011 08:40:43 AM
Old 06-28-2011
How to generate datetime string?

Hi. I'm hoping there is a simple method where I'm able to generate a datetime string that looks like this (yyyymmddhhmm):

201106280830

The tricky part would be that I need this string to be today's datetime minus 1 year.

Is there anyway to do this?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generate a string

Hi, I want to generate a string like 99999 or 00000 depending upon the number of zeros or nines.. that is if I say 9 then I need the string "9" as 999999999. if I say 4 zeros then i need to get a string 0000. Like my input to a function are number ( 0,1,2) which should be there in the string and... (5 Replies)
Discussion started by: Tux_Raju
5 Replies

2. Shell Programming and Scripting

generate new string from a text file

Hi, I have a file and the content looks like this: line1 line2 File #5 : found '/u01/testing.txt' line5 line6 line7 File #12 : found '/u01/testabc.txt' line10 line11 I want to write a bash script to give me the output: The file 5 is '/u01/testing.txt' The file 12 is... (6 Replies)
Discussion started by: walterwaston
6 Replies

3. Programming

SQL datetime calculations

Suppose I have a table as follows: CREATE TABLE data ( `datetime` datetime DEFAULT NOT NULL, `temperature` float DEFAULT NO NULL ); populated with temperature samples of a couple times a second. Let's say I want to find the temperatures which are 1 second apart: SELECT D1.datetime,... (3 Replies)
Discussion started by: figaro
3 Replies

4. Shell Programming and Scripting

datetime.pm

Hi, I'm trying to use datetime.pm function in Perl. I do not have in the library. Is there a way to get it and put it into library? Thanks, George. (1 Reply)
Discussion started by: gpaulose
1 Replies

5. Shell Programming and Scripting

How to compare datetime?

Hi, To get the batch status, I will need to check if the particular job started after 5PM. if the job start time is before 5 pm, then it means that the job has not started for this particular date. I will run the script with date as argument. For eg: BS 07/10/2012 Start time from the log is... (8 Replies)
Discussion started by: ajayakunuri
8 Replies

6. Shell Programming and Scripting

Adding 48 hours to DateTime

Hey Guys, I have looked for a solution throughout the forum for my particular question, but I cant find one. So I'm sorry if I overlooked it. I need to be able to 48 add hours to a particular DateTime string. I have a variable named $startTime I would like to be able to take that... (1 Reply)
Discussion started by: chagan02
1 Replies

7. AIX

AIX DateTime Computation

Good day people, Kindly advice on below please. 1) Formatting/ Arithmetic operation of given date I understand from the AIX man date and some research that flag -d is not applicable for AIX shell scripting and some of the UNIX command date command is not available in AIX. Please advice... (1 Reply)
Discussion started by: cielle
1 Replies

8. UNIX for Dummies Questions & Answers

Find files between two datetime..

Hi All, How do i find all the files between two times. Eg: 26 may 2014 06:00 to 26 may 2014 14:00 mmin and mtime gives for a specific period. we receive hundreds of files input directories and i need to find how many files are received between given specific datetime. Thanks. (2 Replies)
Discussion started by: abhi_123
2 Replies

9. Shell Programming and Scripting

Filename with datetime

Hello All, I need unix command to generate a file with datetime in it. For example : ABC_YYYYMMDDHH24MISS.txt Regards Biswajeet Ghosh (1 Reply)
Discussion started by: bghosh
1 Replies

10. Shell Programming and Scripting

Generate a string of alphanumeric characters

Hi, I want a script of a code that will allow me to generate all possible combinations of alphanumberica characters of length 12 such that each string will contain numbers and either small or capital letters. For example a string may look like this: 123AB45cd678. (11 Replies)
Discussion started by: faizlo
11 Replies
datetime(3)						     Library Functions Manual						       datetime(3)

NAME
datetime - convert between TAI labels and seconds SYNTAX
#include <datetime.h> void datetime_tai(&dt,t); datetime_sec datetime_untai(&dt); struct datetime dt; datetime_sec t; DESCRIPTION
International Atomic Time, TAI, is the fundamental unit for time measurements. TAI has one label for every second of real time, without complications such as leap seconds. A struct datetime variable, such as dt, stores a TAI label. dt.year is the year number minus 1900; dt.mon is the month number, from 0 (January) through 11 (December); dt.mday is the day of the month, from 1 through 31; dt.hour is the hour, from 0 through 23; dt.min is the minute, from 0 through 59; dt.sec is the second, from 0 through 59; dt.wday is the day of the week, from 0 (Sunday) through 6 (Saturday); dt.yday is the day of the year, from 0 through 365. The datetime library supports more convenient TAI manipulation with the datetime_sec type. A datetime_sec value, such as t, is an integer referring to the tth second after the beginning of 1970 TAI. The first second of 1970 TAI was 0; the next second was 1; the last second of 1969 TAI was -1. The difference between two datetime_sec values is a number of real-time seconds. datetime_tai converts a datetime_sec to a TAI label. datetime_untai reads a TAI label (specifically dt.year, dt.mon, dt.mday, dt.hour, dt.min, and dt.sec) and returns a datetime_sec. SEE ALSO
now(3) datetime(3)
All times are GMT -4. The time now is 01:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy