Sponsored Content
Top Forums Shell Programming and Scripting single digit for day and month on date Post 302244369 by vidyadhar85 on Tuesday 7th of October 2008 09:30:33 PM
Old 10-07-2008
date +"%Oe"
this will display date in single digit.. you wnat month too in single digit??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron to run first day of month to calculate date 3 months ago

Hi, I would like to find out how can i calculate a date which is 3 months ago. I intend to run a cron job on the 1st of every month, and calculate the month 4 months earlier from the date. For example, if today's date is 1st May 2007, i would like to return 012007( January 2007). i can get... (1 Reply)
Discussion started by: new2ss
1 Replies

2. 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

3. Shell Programming and Scripting

month in single digit

hi all, how do i get the month in single digit in ksh script ?? my command for date is : /usr/bin/date +%Om/%Oe/%y | sed 's/ //g' which returns "01/16/09" but i need the output to be "1/16/09" i.e the month without leading zero. thanks in advance. (2 Replies)
Discussion started by: cesarNZ
2 Replies

4. Shell Programming and Scripting

Single digit date to double digit date.

I have a var storing date var=`date` Now the date is returned as Mon Feb 2 00:25:48 PST 2009 Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var" My intention in above case is... (3 Replies)
Discussion started by: villain41
3 Replies

5. Shell Programming and Scripting

Get yesterday's date in year-month-day format?

Dear All, Actually, i'm doing some reporting job and i need to pass yesterday's date in Year-Month-Day format(e.g. 2009-06-10) to another program for generating 2009-06-10 report. to get today's date, it's easy to just date '+%Y%m%d' , but no idea how can i get this kind of format for... (2 Replies)
Discussion started by: tiger2000
2 Replies

6. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

7. Shell Programming and Scripting

Script to counting a specific word in a logfile on each day of this month, last month etc

Hello All, I am trying to come up with a shell script to count a specific word in a logfile on each day of this month, last month and the month before. I need to produce this report and email it to customer. Any ideas would be appreciated! (5 Replies)
Discussion started by: pnara2
5 Replies

8. Shell Programming and Scripting

convert two digit in to single digit...

Hi Guys. My Input: ABCD 12 00 KL ABCD 12 08 DL ABCD 12 10 KK ABCD 12 04 LL ABCD 13 00 LP ABCD 13 1O LS Output: ABCD 12 0 KL ABCD 12 8 DL ABCD 12 10 KK ABCD 12 4 LL ABCD 13 0 LP (2 Replies)
Discussion started by: pareshkp
2 Replies

9. UNIX for Dummies Questions & Answers

[SOLVED] how to extract the day and month from a user supplied date ?

Hi All , I am trying to extract the day and month from a user supplied date . But not able . Please help . This is what I am trying to do , I have followed other articles in this scenario. userdate=$1 echo "Script parameter userdate is $userdate" The output of this is in this... (7 Replies)
Discussion started by: megha2525
7 Replies

10. UNIX for Beginners Questions & Answers

How to get first & last day of a month from current date?

Hi, I need the first & last day of a month from any given date. For better understanding, if i need to back-fill data for date 07/20/2019 i.e July 20 2019, i need the first & last day has 07/01/2019 - 07/31/2019. FYI: I'm using GIT BASH terminal. sample code: export DT=$(date --date='6 days... (2 Replies)
Discussion started by: Rocky975583
2 Replies
DATETIME.MODIFY(3)							 1							DATETIME.MODIFY(3)

DateTime::modify - Alters the timestamp

       Object oriented style

SYNOPSIS
public DateTime DateTime::modify (string $modify) DESCRIPTION
Procedural style DateTime date_modify (DateTime $object, string $modify) Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(3). PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $modify -A date/time string. Valid formats are explained in Date and Time Formats. RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.6 | | | | | | | Absolute date/time statements now take effect. | | | Previously, only relative parts were used. | | | | | 5.3.0 | | | | | | | Changed the return value on success from NULL to | | | DateTime. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.modify(3) example Object oriented style <?php $date = new DateTime('2006-12-12'); $date->modify('+1 day'); echo $date->format('Y-m-d'); ?> Procedural style <?php $date = date_create('2006-12-12'); date_modify($date, '+1 day'); echo date_format($date, 'Y-m-d'); ?> The above examples will output: 2006-12-13 Example #2 Beware when adding or subtracting months <?php $date = new DateTime('2000-12-31'); $date->modify('+1 month'); echo $date->format('Y-m-d') . " "; $date->modify('+1 month'); echo $date->format('Y-m-d') . " "; ?> The above example will output: 2001-01-31 2001-03-03 SEE ALSO
strtotime(3), DateTime.add(3), DateTime.sub(3), DateTime.setDate(3), DateTime.setISODate(3), DateTime.setTime(3), DateTime.setTimes- tamp(3). PHP Documentation Group DATETIME.MODIFY(3)
All times are GMT -4. The time now is 09:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy