Hi,

I need to add a date/time stamp to my output file in the following format:

YYYYMMDDHHMMSS (without any segment delimeters etc.).  Is there a way to achieve this in Sage Intelligence?

Views: 68

Reply to This

Replies to This Discussion

Hi,

Copy the following function in a VBA module. The function will then be available in your sheets. It converts the current day/time into the format you're looking for (no parameters are passed to the function)

Public Function TimeToYYYYMMDDHHMMSS() As String

On Error GoTo ErrorHandler

Dim sglDay As Single
Dim sglMonth As Single
Dim sglYear As Single
Dim sglHours As Single
Dim sglMinutes As Single
Dim sglSeconds As Single

sglYear = Year(Date)
sglMonth = Month(Date)
sglDay = Day(Date)
sglHours = Hour(Now)
sglMinutes = Minute(Now)
sglSeconds = Second(Now)
TimeToYYYYMMDDHHMMSS = Str((sglYear * 10000000000#) + (sglMonth * 100000000) + (sglDay * 1000000) + _
(sglHours * 10000) + (sglMinutes * 100) + (sglSeconds * 1))

Exit_Point:

Exit Function

ErrorHandler:
TimeToYYYYMMDDHHMMSS = ""
Resume Exit_Point

End Function

Dino

RSS

The Sage Intelligence Blog

Like Sage Intelligence?

Follow @SageSupport

© 2019   Created by Sage Alchemex.   Powered by

Badges  |  Report an Issue  |  Terms of Service