Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex DateTime formatting - Crystal XI

Status
Not open for further replies.

CarolCook

IS-IT--Management
Mar 7, 2003
158
US
I need a datetime formula in the following format:

YYYYMMDDHHMSS-ZZZZ where ZZZZ is the GMT time zone offset.

Any help would be appreciated.

Thanks
 
The first bit can be done with a ToText Function....
ToText({DateTimeField},"yyyyMMddHHmm"

To get the timezone offset you would need the PrintTimeZone or DataTimeZone Functions. I've got them in Crystal 2011, and I think they were there in 2008, but I don't think any earlier.

From the Help Page...
Time zones are represented by TimeZoneString, which is a string that follows these formats:
"std,offset,dst,[offset];start[/time],end[/time]"
Example: "PST,480,PDT,-60;4.1.0/02:00,10.1.0/02:00"

So you might need to test if you are in DayLight Savings Time or Not.

Bruce Ferguson
 
When I use a variation of that formula

totext({?AccountingCutOffDate},"MM/DD/YYYY")

I get 12/DD/YYYY

Have verified that the raw date is 12/31/2001

Thanks so much for your help!
 
i believe it is case sensitive. your DD and YYYY need to be dd and yyyy.
 
That is exactly the problem. Case sensitivity in a format string. Huh.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top