Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Simple 'date' to 001 scheme script Post 302958147 by pasc on Tuesday 20th of October 2015 03:37:02 AM
Old 10-20-2015
yes, if it simplifies it, I could.
 

10 More Discussions You Might Find Interesting

1. Tips and Tutorials

Simple date and time calulation in BASH

The GNU date command in full of goodies but not when it comes to calculate a date or time difference. Here is what I came up with after looking to more than one solution. Code should be self explaining. #!/bin/bash date2stamp () { date --utc --date "$1" +%s } stamp2date (){ ... (0 Replies)
Discussion started by: ripat
0 Replies

2. HP-UX

a simple way of converting a date in seconds to normal date

Hi all! I'm working on a HPUX system, and I was wondering if there is a simple way to convert a date from seconds (since 1970) to a normal date. Thanks (2 Replies)
Discussion started by: travian
2 Replies

3. Shell Programming and Scripting

simple date problem

i have a script that grep for today date a=`date +"%F"`--------greps current/today date wat if suppose i want to grep a date for yesterday... how to do that using the above format: i,e 2008-01-20 (4 Replies)
Discussion started by: ali560045
4 Replies

4. Shell Programming and Scripting

Simple date formatting?

Hi guys, I have some embedded perl within my shell script to get me the modification time/date of a file which returns me the following string: Fri May 1 09:52:58 2009 I have managed to get the bits i need such as 1-May-2009, but what i would prefer is 010509 instead... Here is my... (4 Replies)
Discussion started by: muay_tb
4 Replies

5. Shell Programming and Scripting

Simple date issue

Hi all, i have used the search already before someone shouts at me and i have seen the 'datecalc' program but this is not working correctly for me in the shell and environment i am using. I am using solaris 10 and bourne shell. I have two dates '07-04-2009' and '05-05-2009'. I just need to... (2 Replies)
Discussion started by: muay_tb
2 Replies

6. Shell Programming and Scripting

How can get the value 001 using shell script

Hi Gurus, Please help in this shell script. x=000 y=`expr $x + 1` echo $y which gives me the value as 1 How can i get the value as 001 in this shell script. As i am new to scripting stuck up here. Requesting here help here (2 Replies)
Discussion started by: nmadhuhb
2 Replies

7. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

8. Shell Programming and Scripting

Simple date and time calulation in BASH

There is a closed Thread: <url>Here will be the url to the original post once I have 5 posts in this forum...</url> But a small bug had found his way into this very cool and simple code. #!/bin/bash date2stamp () { date --utc --date "$1" +%s } stamp2date (){ date --utc --date... (2 Replies)
Discussion started by: frood
2 Replies

9. Shell Programming and Scripting

Simple date issue

Hi , Here is the smaller version of the problem. Working individually as command ************************>echo $SHELL /bin/bash ************************>TO_DAY=`date` ************************>echo $TO_DAY Tue Jul 16 02:28:31 EDT 2013 ************************> Not working when... (5 Replies)
Discussion started by: Anupam_Halder
5 Replies

10. Shell Programming and Scripting

How to do simple date (time) calculation in shell script?

Hi, I'm looking for a way to do a simple math calc during a shell script as a means of logging how long a particular task takes. For example... STARTTIME=whenever this script starts ./path/to/command.sh >>logfile.log TOTALTIME=<time at this stage of the script after above command... (7 Replies)
Discussion started by: nbsparks
7 Replies
STRFTIME(3)						     Library Functions Manual						       STRFTIME(3)

NAME
strftime - format date and time SYNOPSIS
#include <sys/types.h> #include <time.h> #include <string.h> size_t strftime(buf, maxsize, format, timeptr) char *buf; size_t maxsize; char *format; struct tm *timeptr; DESCRIPTION
The strftime() function formats the information from timeptr into the buffer buf according to the string pointed to by format. The format string consists of zero or more conversion specifications and ordinary characters. All ordinary characters are copied directly into the buffer. A conversion specification consists of a percent sign ``%'' and one other character. No more than maxsize characters will be placed into the array. If the total number of resulting characters, including the terminating null character, is not more than maxsize, strftime() returns the number of characters in the array, not counting the terminating null. Other- wise, zero is returned. Each conversion specification is replaced by the characters as follows which are then copied into the buffer. %A is replaced by the full weekday name. %a is replaced by the abbreviated weekday name, where the abbreviation is the first three characters. %B is replaced by the full month name. %b or %h is replaced by the abbreviated month name, where the abbreviation is the first three characters. %C is equivalent to ``%a %b %e %H:%M:%S %Y'' (the format produced by asctime(3)). %c is equivalent to ``%m/%d/%y''. %D is replaced by the date in the format ``mm/dd/yy''. %d is replaced by the day of the month as a decimal number (01-31). %e is replaced by the day of month as a decimal number (1-31); single digits are preceded by a blank. %H is replaced by the hour (24-hour clock) as a decimal number (00-23). %I is replaced by the hour (12-hour clock) as a decimal number (01-12). %j is replaced by the day of the year as a decimal number (001-366). %k is replaced by the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank. %l is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank. %M is replaced by the minute as a decimal number (00-59). %m is replaced by the month as a decimal number (01-12). %n is replaced by a newline. %p is replaced by either ``AM'' or ``PM'' as appropriate. %R is equivalent to ``%H:%M'' %r is equivalent to ``%I:%M:%S %p'' . %t is replaced by a tab. %S is replaced by the second as a decimal number (00-60). %T or %X is equivalent to "%H:%M:%S" . %U is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number (00-53). %W is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (00-53). %w is replaced by the weekday (Sunday as the first day of the week) as a decimal number (0-6). %x is equivalent to ``%m/%d/%y %H:%M:%S'' . %Y is replaced by the year with century as a decimal number. %y is replaced by the year without century as a decimal number (00-99). %Z is replaced by the time zone name. %% is replaced by `%' . SEE ALSO
date(1), ctime(3), printf(1), printf(3) STANDARDS
The strftime() function conforms to ANSI X C3.159-1989(``ANSI C''). BUGS
There is no conversion specification for the phase of the moon. 4.2 Berkeley Distribution April 1, 1995 STRFTIME(3)
All times are GMT -4. The time now is 01:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy