- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Date in the Format YYMMDD
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 03:08 AM
тАО12-03-2010 03:08 AM
I was wondering if someone could provide me with the correct function/syntax to get the date the format YYMMDD, so 03-Dec-2010 will display as 101203.
Thanks,
Niall
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 03:24 AM
тАО12-03-2010 03:24 AM
Solutionseldom only one correct way. If "the date"
means today's date, then this seems to work:
alp $ write sys$output f$extract( 2, 8, f$cvtime( f$time()))- "-"- "-"
101203
If you want to convert some arbitrary date,
then you could replace "f$time()" with the
appropriate string:
alp $ write sys$output f$extract( 2, 8, f$cvtime( "25-Dec-2010"))- "-"- "-"
101225
HELP LEXICALS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 03:28 AM
тАО12-03-2010 03:28 AM
Re: Date in the Format YYMMDD
Hmmm. Taking my own advice, for today's
date, there's yet another default value in
F$CVTIME():
alp $ write sys$output f$extract( 2, 8, f$cvtime())- "-"- "-"
101203
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 03:39 AM
тАО12-03-2010 03:39 AM
Re: Date in the Format YYMMDD
> seldom only one correct way. [...]
alp $ t = f$time()
alp $ write sys$output f$extract( 2, 2, f$cvtime( t, , "YEAR"))+ -
_alp $ f$cvtime( t, , "MONTH")+ f$cvtime( t, , "DAY")
101203
As usual, many things are possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 05:30 AM
тАО12-03-2010 05:30 AM
Re: Date in the Format YYMMDD
>> the correct function/syntax
In what context / language
DECforms? TDMS? / Cobol? Basic?
What is the representation of the source date?
What need to happen for 19xx dates? 21xx?
Should there be a sliding window?
As Steven wrote, in DCL one can just take the leading century characters away.
The easiest way to do that, and most sloppy way, is:
$ write sys$output f$cvtime(,,"DATE") -"20"-"-"-"-"
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2010 11:44 AM
тАО12-03-2010 11:44 AM
Re: Date in the Format YYMMDD
If you want the dates to be displayed this way in direcotory or other utilities that use the LIB$ routines like LIB$FORMAT_DATE_TIME to format dates, then you can define the logical LIB$DT_FORMAT to one of many format types.
See sys$manager:systartup_vms.template (and search for date), and SYS$STARTUP:LIB$DT_STARTUP.COM for the predefined format specifiers.
Here's an example: (This assumes LIB$DT_STARTUP was used in startup)
$ sho log lib$dt_format
"LIB$DT_FORMAT" = "LIB$DATE_FORMAT_001" (LNM$SYSTEM_TABLE)
= "LIB$TIME_FORMAT_001"
$ dir sys$login:login.com;/date
Directory ROOT$USERS:[JON]
LOGIN.COM;245 12-DEC-2009 11:56:30.00
Total of 1 file.
$ def lib$dt_format lib$date_format_026
$ dir sys$login:login.com;/date
Directory ROOT$USERS:[JON]
LOGIN.COM;245 091212
Total of 1 file.
$ def lib$dt_format lib$date_format_026,lib$time_format_001
%DCL-I-SUPERSEDE, previous value of LIB$DT_FORMAT has been superseded
$ dir sys$login:login.com;/date
Directory ROOT$USERS:[JON]
LOGIN.COM;245 091212 11:56:30.00
Total of 1 file.
$ sho log lib$dt_format
"LIB$DT_FORMAT" = "LIB$DATE_FORMAT_026" (LNM$PROCESS_TABLE)
= "LIB$TIME_FORMAT_001"
"LIB$DT_FORMAT" = "LIB$DATE_FORMAT_001" (LNM$SYSTEM_TABLE)
= "LIB$TIME_FORMAT_001"
$ deas lib$dt_format
$ dir sys$login:login.com;/date
Directory ROOT$USERS:[JON]
LOGIN.COM;245 12-DEC-2009 11:56:30.00
Total of 1 file.
$
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2010 04:54 AM
тАО12-06-2010 04:54 AM
Re: Date in the Format YYMMDD
Thanks for your responses; it was 'my bad'. What I want is to be able to define today's date in a com file so I will to be able to copy a file with today's date as part of the file name. So something like this:
$ write sys$output f$extract( 2, 8, f$cvtime( f$time()))- "-"- "-"
$!
$! **define date (below) to be the output of the above**
$ scp2 games_'date'.XML
"root@10.10.10.100::/srv/games.xml"
Sorry for the confusion.
Regards,
Niall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2010 01:21 PM
тАО12-07-2010 01:21 PM
Re: Date in the Format YYMMDD
$ set noon
$ set nover
$ wfechahoy = f$cvtime("today","comparison",)
$ aammdd = f$extract(2,2,wfechahoy) + f$extract(5,2,wfechahoy) + f$extract(8,2,wfechahoy)
$ sh symb aammdd
$ descrip_file = "FILE_DATE_" + aadddd + ".XML;"
$
$ dir 'descrip_file
$!
Good luck,
Eduardo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2010 01:28 PM
тАО12-07-2010 01:28 PM
Re: Date in the Format YYMMDD
$!Start DCL
$ set noon
$ set nover
$ wfechahoy = f$cvtime("today","comparison",)
$ aammdd = f$extract(2,2,wfechahoy) + f$extract(5,2,wfechahoy) + f$extract(8,2,wfechahoy)
$ sh symb aammdd
$ descrip_file = "FILE_DATE_" + aammdd + ".XML;"
$
$ dir sys$startup:ope*.log /out='descrip_file
$ dir 'descrip_file
$!
$!End DCL