![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Setting different short date formats Topic Summary: Created On: 2-Oct-2008 14:51 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Is anyone familiar with setting different date formats with dxl? I'm writing to a file from a buffer and I'd like to change the output date format... A function is referenced in the dxl manual called 'setDateFormat(Locale)' but I'm not able to get it to work. Any ideas??
Thanks! |
|
![]() |
|
![]() |
|
If you have a date you want to write out, use the stringOf(Date d, string s) function.
The string should be of a supported format. For October 2, 2008 use "MMMM d, yyyy" For 10/02/08 use "MM/dd/yy" For Oct 2, 2008 use "MMM d, yyyy" Most American and UK standard ways of writing dates are supported. ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|
![]() |
|
![]() |
|
I can get that to work fine, but it's within the 'write()' command where I'm having trouble. I'm writing out to an Excel file and I'd like to get the date included in the file name. The only date commands that won't produce an error when writing are 'today()' and 'dateOnly()'. But those two commands both spit out '02 October 2008', so I thought maybe I could change the short date format in the locale directly within the script.
A format such as 'M/d/yyyy' or 'MM/dd/yy' is what i was hoping for, but here's the code as of now... |
|
![]() |
|
![]() |
|
the backslash is not allowed in a filename. You will need to replace the backslashes with something else like a hyphen. I believe that should get you the filename format you are looking for.
Edited: 2-Oct-2008 at 20:12 by Douglas Zawacki |
|
![]() |
|
![]() |
|
So do stringOf(today, "MM/dd/yy")
Or for hyphens do stringOf(today, "MM-dd-yy") ------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com Edited: 2-Oct-2008 at 22:39 by David Pechacek |
|
![]() |
|
![]() |
|
Thanks Doug, I completely disregarded what characters are not allowed when writing my script. Here's what I ended up with for writing the file name...
It sets the date format to MMM-dd-yyyy, and then changes the time format by replacing the colons with 'dot' characters... |
|
![]() |
|
![]() |
|
Cool,
Good point David, I completely had a brain lapse on that one. That's what I get for typing too quickly without thinking ![]() Ryan, I just wanted to point out that using the format "MM-dd-yyyy" in your file names may cause you a bit of grief when you are dealing with files from multiple years....They will not sort properly. That's why I like the format "yyyy-MM-dd" The sorting works best for me. |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Setting different short date formats
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.