Format Date when it is Private Data

Post Reply
bpletka
Newbie
Posts: 10
Joined: Tue Sep 21, 2021 12:00 am

Format Date when it is Private Data

Post by bpletka »

Is there a way to format a date when it is Private Data?

Data is current showing 01-Jan-23. The formatting needs to show 1/1/2023.

Thanks-

Bill
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Format Date when it is Private Data

Post by jan_suhr »

Have you tried this for the current date?

CurrentDate=[Switch.Date:Format="d/MMM/yyyy",TimeZone="UTC"]

It will show 10/feb/2023

https://www.enfocus.com/manuals/UserGui ... tting.html
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
bpletka
Newbie
Posts: 10
Joined: Tue Sep 21, 2021 12:00 am

Re: Format Date when it is Private Data

Post by bpletka »

Thanks for the info.

I am in need of formatting a date that is private data. I do not need to generate a date from Switch.
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Format Date when it is Private Data

Post by jan_suhr »

Where do you get your date from? Can it be formatted from that source?
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Format Date when it is Private Data

Post by freddyp »

Private data is always a string. Converting it to a Date requires the use of a script (expression).

I tried a second approach using Jan's apps "Make XML/JSON". I hoped that placing the private data into a very simple XMLJSON dataset and extracting it using the Date type would recognize it as a Date, but unfortunately it did not.
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Format Date when it is Private Data

Post by jan_suhr »

Maybe the app Date Calculator can fix it for you. It is possible to calculate with the value zero for the new date. You will get a lot of private data keys for different parts of the date. It will however give it in ISO-format, it meant to be used in Switch.

But you can use the string replace app to format the date to your needs.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
bpletka
Newbie
Posts: 10
Joined: Tue Sep 21, 2021 12:00 am

Re: Format Date when it is Private Data

Post by bpletka »

I did try the date calculator app. That will not work as the date must be yyyy-MM-dd or it will fail.

I have the app for string replacement. I am struggling to understand the setup of the app. The instructions are not clear to me.
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Format Date when it is Private Data

Post by jan_suhr »

bpletka wrote: Tue Feb 14, 2023 7:27 pm I did try the date calculator app. That will not work as the date must be yyyy-MM-dd or it will fail.

I have the app for string replacement. I am struggling to understand the setup of the app. The instructions are not clear to me.
You haven't really told us what the input is, where it come from and in which format.

With the Date Calculator app you will get a lot of PrivateData tags and from them you can construct the date format you want.
You could also use the app Row2Variables where you can have an Excel table with the month digits and the corresponding text for each numeric value.

It will work in the way that you get 03 from the Date Calculator and in the Row2Variable you call the PrivateData tag with the month number and you will get a new PrivateData with the text "MAR" (or what ever you decide to match 03) With these PrivateData tags you can construct your date to 15/MAR/2023
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
bpletka
Newbie
Posts: 10
Joined: Tue Sep 21, 2021 12:00 am

Re: Format Date when it is Private Data

Post by bpletka »

The data is coming out of tab delimited file and split through the ASI List Magic App. This becomes private data. Switch does not see this as a date in its current form. That is when I realized I could go about this a different way and I figured out a fix.

I used string splitter to create new private data and then used string replace to change the data. I combined it all in the meta tagger to create the date format I needed.

Thanks for all the input and ideas!
Post Reply