Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

display previous one day's date using SUN Solaris 7

Posted on 2002-03-06
7
Medium Priority
?
1,915 Views
Last Modified: 2013-12-05
Hi!
I have some UNIX script need to help from you all experts.
How do display previous one day's using UNIX script on SUN Solaris?
The date of type display is YYMMDD

E.g: (1) "For display today date"
#date
Thu Mar  7 13:36:12 SGT 2002
 
E.g: (2) "For display today date with type YYMMDD"
#date -u '+%y%m%d'
020307

How to display the date on one day before current day?
I meant if today is 020307 (2002 March 07), when I type the command it should be display: 020306 (2002 March 6).

Thank you very much!
Geoffry.
0
Comment
Question by:geoffry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 24

Expert Comment

by:SunBow
ID: 6847740
Change the clock.
If your application needs that so badly from OS, for example, to simulate being in another country, another time zone, etc., then best to just configure the server as if it was located in the area being serviced. That gets around a few other problems, such as TZ & DST.

If not, just a cosmetic for application, then the tools of the application should modify it, and not require any hacks to the OS clock.
0
 
LVL 24

Expert Comment

by:SunBow
ID: 6847743
(not to mention synchronization and networking communication)
0
 
LVL 4

Expert Comment

by:newmang
ID: 6848573
Can you explain the situation where you need this function as the way to do it would depend on why you want to do it.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 1200 total points
ID: 6852675
env TZ=GMT+24 date +%y%m%d
# assuming that your TZ is GMT
0
 
LVL 1

Expert Comment

by:mbreuer
ID: 6861677
Don't know if the standard sun date routine has this... linux does:

date --date=yesterday works for me.  You could use the gpl'd date routine and compile on solaris if not already supported.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6862656
--date is a GNU option;
My TZ suggestion works on any flaviour of UNIX/Linux for at least 24 hours timeshift (up to .. I don't realy know, depends on UNIX ;-)
0
 
LVL 2

Author Comment

by:geoffry
ID: 6887526
Thank you very much!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question