Sponsored Content
Operating Systems Solaris Extract century from date (Solaris platform) Post 98613 by Perderabo on Thursday 9th of February 2006 12:34:42 PM
Old 02-09-2006
Try:
$ date '+%Y%m%d:%H%S'
20060209:1252

Note that I have a single quote before and after the argument to date. You only have a single quote before the argument. You're getting away with that because the whole date command is enclosed in back quotes. The result you get with your date command is correct and HP-UX gives the same result.

Using HHSS is really odd. Most of us would stick the minutes in there too. But I guess it's your script.
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How HDD under Solaris on Intel platform

On my Intel PC I have 4GB HDD on which I installed Solaris. I also installed 30GB HDD but the bios does not recognize anything beyond 8GB and that is what Solaris picks up. Under WinNT is an utility that allows me to access and format the full capacity of this 30GB HDD no matter what the bios... (4 Replies)
Discussion started by: softarch
4 Replies

2. Solaris

Need J2SDK 1.4 for Solaris Sparc 8 platform

Hi, I need j2sdk 1.4 for solaris sparc 8 platform. I searched it over sun java site but not able to find that for the particular soalris platform. I was able to see j2sdk 1.3 , but I need j2sdk 1.4 for solaris. Can any body send me some link where I could download it. Plz help me for this ,... (1 Reply)
Discussion started by: aarora_98
1 Replies

3. Solaris

best vm platform for x86 solaris

Anyone recommend the best VM platform to run x86 solaris on my dell laptop? A free platform.. (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

4. Solaris

ZFS on solaris 10 with x86 platform

HI , I required brief about the zfs creation on solaris 10 with x86 platform. I had done with sparc system. Is it same or different as Sparc. (3 Replies)
Discussion started by: sunray
3 Replies

5. UNIX for Dummies Questions & Answers

How to display century in UNIX.

Hi, I wanted to display Century in Unix. I tried with date +"%C" Which is displaying Mon Aug 29 12:54:54 BST 2011. (Used capital C). and when used date +"%c" Displaying Mon Aug 29 12:54:33 2011. (used Small c) But i want century (21) to get displayed. Please let me know how can i do... (5 Replies)
Discussion started by: nithyasreerupa
5 Replies

6. Shell Programming and Scripting

Extract week start,end date from given date in PERL

Hi All, what i want to do in perl is i should give the date at run time .Suppose date given is 23/12/2011(mm/dd/yyyy) the perl script shold find week start date, week end date, previous week start date,end date,next week start date, end date. In this case week start date will be-:12/19/2011... (2 Replies)
Discussion started by: parthmittal2007
2 Replies
Data::Faker::DateTime(3pm)				User Contributed Perl Documentation				Data::Faker::DateTime(3pm)

NAME
Data::Faker::DateTime - Data::Faker plugin SYNOPSIS AND USAGE
See Data::Faker DATA PROVIDERS
unixtime Return a unix time (seconds since the epoch) for a random time between the epoch and now. date Return a random date as a string, using a random date format (see date_format). time Return a random time as a string, using a random time format (see time_format). rfc822 Return an RFC 822 formatted random date. This method may not work on systems using a non-GNU strftime implementation (kindly let me know if that is the case.) ampm Returns am or pm randomly (in the current locale) using one of the formats specified in ampm_format. time_format Return a random time format. date_format Return a random date format. ampm_format Return a random am/pm format. datetime_format Return a random date and time format. month Return a random month name, unabbreviated, in the current locale. month_abbr Return a random month name, abbreviated, in the current locale. weekday Return a random weekday name, unabbreviated, in the current locale. weekday_abbr Return a random weekday name, abbreviated, in the current locale. sqldate Return a random date in the ISO8601 format commonly used by SQL servers (YYYY-MM-DD). datetime_locale Return a datetime string in the preferred date representation for the current locale, for a random date. date_locale Return a date string in the preferred date representation for the current locale, for a random date. time_locale Return a time string in the preferred date representation for the current locale, for a random date. century Return a random century number. dayofmonth Return a random day of the month. UTILITY METHODS
Data::Faker::DateTime::timestr($format); Given a strftime format specifier, this method passes it through to POSIX::strftime along with a random date to display in that format. Perl passes this through to the strftime function of your system library, so it is possible that some of the formatting tokens used here will not work on your system. NOTES AND CAVEATS
Be careful build timestamps from pieces Be very careful about building date/time representations in formats that are not already listed here. For example if you wanted to get a date that consists of just the month and day, you should NOT do this: my $faker = Data::Faker->new(); print join(' ',$faker->month,$faker->dayofmonth)." "; This is bad because you might end up with 'February 31' for example. Instead you should use the timestr utility function to provide you a formatted time for a valid date, or better still, write a plugin function that does it: my $faker = Data::Faker->new(); print $faker->my_short_date()." "; package Data::Faker::MyExtras; use base qw(Data::Faker); use Data::Faker::DateTime; __PACKAGE__->register_plugin( my_short_date => sub { Data::Faker::DateTime::timestr('%M %e') }, ); POSIX::strftime See the documentation above regarding the timestr utility method for some caveats related to strftime and your system library. SEE ALSO
Data::Faker AUTHOR
Jason Kohles, <email@jasonkohles.com> COPYRIGHT AND LICENSE
Copyright 2004-2005 by Jason Kohles This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2005-07-14 Data::Faker::DateTime(3pm)
All times are GMT -4. The time now is 09:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy