EcoStruxure Geo SCADA Expert Forum
Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-24 09:07 PM . Last Modified: 2023-05-02 11:55 PM
Hi Experts,
Another small problem I'm dealing with, as I can't seem to determine the proper syntax.
I am pulling in a GeoScada Date Tag into a VBA script and I need to format it in the following way YYYMMDD
I can't seem to determine the Syntax of the instruction in VBA
I've tried using:
MsgBox Format(MyTime, "YYYMMDD")
MsgBox FormatVar(MyTime, "YYYMMDD")
as well as both those functions with the Variable / formatting reversed.
Can someone shed some light as to what I'm doing wrong here?
Date as pulled by Geoscada Expert is the following format when displayed using
msgbox MyTime
6/22/2022 3:00:00 PM
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-26 09:11 PM
You've said "...GeoScada Date Tag into a VBA script.." so you're obviously not using the ViewX scripting, since that is NOT VBA (it's VBscript or JScript).
Hence if using VBA then you want to follow the formatting from here:
With the examples as given below (from the link)
Dim MyTime, MyDate, MyStr
MyTime = #17:04:23#
MyDate = #January 27, 1993#
' Returns current system time in the system-defined long time format.
MyStr = Format(Time, "Long Time")
' Returns current system date in the system-defined long date format.
MyStr = Format(Date, "Long Date")
MyStr = Format(MyTime, "h:m:s") ' Returns "17:4:23".
MyStr = Format(MyTime, "hh:mm:ss am/pm") ' Returns "05:04:23 pm".
MyStr = Format(MyTime, "hh:mm:ss AM/PM") ' Returns "05:04:23 PM".
MyStr = Format(MyDate, "dddd, mmm d yyyy") ' Returns "Wednesday, Jan 27 1993".
' If format is not supplied, a string is returned.
MyStr = Format(23) ' Returns "23".
' User-defined formats.
MyStr = Format(5459.4, "##,##0.00") ' Returns "5,459.40".
MyStr = Format(334.9, "###0.00") ' Returns "334.90".
MyStr = Format(5, "0.00%") ' Returns "500.00%".
MyStr = Format("HELLO", "<") ' Returns "hello".
MyStr = Format("This is it", ">") ' Returns "THIS IS IT".
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.