Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Date to be displayed in two digits Post 302341689 by methyl on Thursday 6th of August 2009 11:33:09 AM
Old 08-06-2009
Or if you are in GMT timezone:

Code:
#!/bin/ksh
echo "Yesterday : $(TZ=GMT24BST;date +'%Y%m%d')"
echo "Today     : $(date '+%Y%m%d')"
echo "Tomorrow  : $(TZ=GMT-24BST;date '+%Y%m%d')"

Yesterday : 20090805
Today     : 20090806
Tomorrow  : 20090807

 

10 More Discussions You Might Find Interesting

1. Solaris

hostname not displayed

Hi, I posted a problem earlier on on how to change IP addresses on an E450. I was able to work around this and wanna say thanks to all who assisted. But now on my server, I get this error, trying to configure hosts..RPC timed out. Also, when I type on the command line, hostname, nothing is... (7 Replies)
Discussion started by: Ronny
7 Replies

2. HP-UX

swlist is not displayed in HP-UX

Hi swlist command is not displayed in HP-UX ..it displays swlist: Command not found. uname -a HP-UX inccishh B.11.11 U 9000/800 4046719263 unlimited-user license :b: Best Regards vasanthan (4 Replies)
Discussion started by: vasanthan
4 Replies

3. Shell Programming and Scripting

Password is getting displayed

My shell script which runs on solaris has an execution in it. Contents of shell script BEGIN : Executable_filename username/password@DBinstance parameter2 parameter3 Contents of shell script END : When i launch the shell script, it connects to database to gets few details.. In the... (3 Replies)
Discussion started by: shafi2all
3 Replies

4. Shell Programming and Scripting

Data displayed in two lines

Hi, I am a newbie to both Linux and this forum. I was trying to pull out the data from a database but it is not showing up in the multiple lines, with my limited knowledge i linux u tried to format this but wasn't exactly getting what i wanted. The screenshot below shows my problem. ... (2 Replies)
Discussion started by: Ninjaa
2 Replies

5. Shell Programming and Scripting

how to sort date in decimal values uptp two digits

Hi all, there is a data in a file wich loks likes 00:00:49|24.48| 00:01:49|22.83| 00:02:49|22.07| 00:03:49|20.72| 00:04:49|21.28| 00:05:49|21.22| 00:06:49|21.38| 00:07:49|20.93| 00:08:49|21.27| 00:09:49|20.65| 00:10:49|19.42| 00:11:49|21.93| 00:12:49|20.62| 00:13:49|20.23|... (3 Replies)
Discussion started by: jojo123
3 Replies

6. Shell Programming and Scripting

help: single digits inflated to 2 digits

Hi Folks Probably an easy one here but how do I get a sequence to get used as mentioned. For example in the following I want to automatically create files that have a 2 digit number at the end of their names: m@pyhead:~$ for x in $(seq 00 10); do touch file_$x; done m@pyhead:~$ ls file*... (2 Replies)
Discussion started by: amadain
2 Replies

7. Shell Programming and Scripting

password getting displayed using sudo

Hi While doing the following command password is gettin dispalyed : ssh <host> "sudo command ; exit" .... while i type my password for 2nd its gettin displayed ... i tried stty -echo and stty echo ... still i am havin problem..:confused: (1 Reply)
Discussion started by: ningy
1 Replies

8. Shell Programming and Scripting

Suppressing a message from being displayed

I have a script which checks for *.txt files in a particular directory and if no files were found then it goes into sleep for 10 secs and looks back for files again and if any files were found then the script does some processing with the files found, which is my requirement too. FILE_EXISTS=`ls... (5 Replies)
Discussion started by: vpv0002
5 Replies

9. Shell Programming and Scripting

Find filenames with three digits and add zeros to make five digits

Hello all! I've looked all over the internet and this site and have come up a loss with an easy way to make a bash script to do what I want to do. I have a file with a naming convention as follows: 2012-01-18 string of words here 123.jpg 2012-01-18 string of words here 1234.jpg 2012-01-18... (2 Replies)
Discussion started by: Buzzman25
2 Replies

10. UNIX for Beginners Questions & Answers

sed / awk script to delete the two digits from first 3 digits

Hi All , I am having an input file as stated below 5728 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r03_q_reg_20_/Q 011 611 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r04_q_reg_20_/Q 011 3486... (4 Replies)
Discussion started by: kshitij
4 Replies
DATETIME.SETISODATE(3)							 1						    DATETIME.SETISODATE(3)

DateTime::setISODate - Sets the ISO date

       Object oriented style

SYNOPSIS
public DateTime DateTime::setISODate (int $year, int $week, [int $day = 1]) DESCRIPTION
Procedural style DateTime date_isodate_set (DateTime $object, int $year, int $week, [int $day = 1]) Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $year - Year of the date. o $week - Week of the date. o $day - Offset from the first day of the week. RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Changed the return value on success from NULL to | | | DateTime. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.setISODate(3) example Object oriented style <?php $date = new DateTime(); $date->setISODate(2008, 2); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; ?> Procedural style <?php $date = date_create(); date_isodate_set($date, 2008, 2); echo date_format($date, 'Y-m-d') . " "; date_isodate_set($date, 2008, 2, 7); echo date_format($date, 'Y-m-d') . " "; ?> The above examples will output: 2008-01-07 2008-01-13 Example #2 Values exceeding ranges are added to their parent values <?php $date = new DateTime(); $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 8); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 53, 7); echo $date->format('Y-m-d') . " "; ?> The above example will output: 2008-01-13 2008-01-14 2009-01-04 Example #3 Finding the month a week is in <?php $date = new DateTime(); $date->setISODate(2008, 14); echo $date->format('n'); ?> The above examples will output: 3 SEE ALSO
DateTime.setDate(3), DateTime.setTime(3). PHP Documentation Group DATETIME.SETISODATE(3)
All times are GMT -4. The time now is 05:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy