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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Time Format

Status
Not open for further replies.

jpstrzoch

Technical User
Mar 24, 2004
59
0
0
US
Greetings,

I want to create a unique order number that is the combination of a Group Level 1 result, the current date and time, as well as some text.

Here is what I have thus far;

{Sheet1_.Region} & CurrentDateTime & "BEVWKS"

This is returning the following'

IR 11/08/2006 12:40:35AM BEVWKS

Ideally I would like the result to be;

IR110806124035BEVWKS

How can I format the "CurrentDateTime" portion of the formula to allow for this result?
 
Try something like

{Sheet1_.Region} &
(if day(currentdatetime) < 10 then "0" & cstr(day(currentdatetime))
else cstr(day(currentdatetime)))
& cstr(month(currentdatetime))
& cstr(year(currentdatetime))
& cstr(hour(currentdatetime))
& cstr(minute(currentdatetime))
& cstr(second(currentdatetime))
& "BEVWKS
 
Hello,

Thank you for your time. I entered your formula exactly as you have writtin it above.

The result was "IE08.0011.002,006.005.0051.0035.00BEVWKS"

what can be done to remove the ".00" or the "," from the string? Too, I would rather lead with the month instead of the day. I see your formula checks to see if the day is < 10 prior to executing. How would the formula change if the month were switched. This would be moot if the string can't be formated to the above specification.

Again thank you.
 
{Sheet1_.Region} &
Cstr(CurrentDateTime,"ddMMyyyyhhmmss")

Bob Suruncle
 
That did it! Thank you very much!

Have a nice day!

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top