Sponsored Content
Top Forums Shell Programming and Scripting Script to find previous month last day minus one day timestamp Post 302350436 by daPeach on Thursday 3rd of September 2009 08:57:52 PM
Old 09-03-2009
Code:
noDay=$(date +%e)
lMonth=$(date -d"-$((noJour+1)) days" +%Y-%m-%d)
date -u -d"$lMonth" +%s
1251590400

?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

2. Shell Programming and Scripting

How to find the first day of previous month in unix?

How to find the first day of previous month in unix mmddyyyy format? example : today is 07052007 (in mmddyyyy) output sud be 06012007 thanks mohapatra (10 Replies)
Discussion started by: mohapatra
10 Replies

3. Shell Programming and Scripting

last working day of previous month

Hi, I want a script(ksh) to see if today is the last working day(Mon-Fri) of the month. If it is the last working day I need to print current date, else I need the last working day of previous month. Thanks in advance. (1 Reply)
Discussion started by: rspk_praveen
1 Replies

4. Shell Programming and Scripting

needs to display month for previous day date

Hello, I wanted to display the month for previous day date. Like, today date is 18-Nov-2008. So the previous date is 17-Nov-2008. The output should be November. If the today date is 1-DEC-2008, then output should be NOVEMBER. If the today date is 1-JAN-2008, then output should be DECEMBER.... (4 Replies)
Discussion started by: govindts
4 Replies

5. Shell Programming and Scripting

Display month for Previous day

Hello - I have one question regarding the date. I wanted to display the month name for previous day. The output should be as follows... 5-Feb-09 => February 1-Feb-09 => January 28-Feb-09=> February Here is the code i am using to get the output.... date '+%m %d %Y' | { read MONTH DAY... (4 Replies)
Discussion started by: govindts
4 Replies

6. AIX

Convert unix timestamp to year month day format ?

Hello, How do I convert unix timestamp value to 'normal' date format - to get year month and day values ? Looks like it's easy to do using GNU date (linux systems). But how do I do tthis on AIX ? I don't want to write C program, any ways to do that using unix shells ? thanks (1 Reply)
Discussion started by: vilius
1 Replies

7. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

8. Programming

How to get First and Last day of previous month from trunc(sysdate)

Hi Guys, How to get First day of previous month and last day of previous month from trunc(sysdate) using SQL..? Thanks in advance. Br, pinpe (2 Replies)
Discussion started by: pinpe
2 Replies

9. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

10. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies
PX_DATE2STRING(3)														 PX_DATE2STRING(3)

px_date2string - Converts a date into a string.

SYNOPSIS
string px_date2string (resource $pxdoc, int $value, string $format) DESCRIPTION
Turns a date as it stored in the paradox file into human readable format. Paradox dates are the number of days since 1.1.0000. This func- tion is just for convenience. It can be easily replaced by some math and the calendar functions as demonstrated in the example below. PARAMETERS
o $pxdoc - Resource identifier of the paradox database as returned by px_new(3). o $value - Value as stored in paradox database field of type PX_FIELD_DATE. o $format - String format similar to the format used by date(3). The placeholders support by this function is a subset of those supported by date(3) (Y, y, m, n, d, j, L). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Turn a paradox date into a human readable form <?php $px = px_new(); /* make up a date as it could be stored in */ /* a date field of a paradox db. */ /* 700000 days since 1.1.0000. */ $days = 700000; /* Use the calendar functions to print a */ /* human readable format of the date */ echo jdtogregorian($days+1721425)." "; /* px_date2string() outputs the same */ echo px_date2string($px, $days, "n/d/Y")." "; px_delete($px); ?> The above example will output: 7/15/1917 7/15/1917 SEE ALSO
px_timestamp2string(3), jdtogregorian(3). PHP Documentation Group PX_DATE2STRING(3)
All times are GMT -4. The time now is 08:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy