LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using CSS to change WebVI timestamp FormatString

Hi

it would be great if this page had an example on how to format the date time string on a NXG WebVI timestamp control, as not everyone wants American date time format with milliseconds. 

https://ni.github.io/webvi-examples/CustomizeWithCss/

 

gviweb is a special kind of VI. It is actually a ​embedded web browser. A lot control properties are different between gvi and .gviweb ( With the normal gvi, the Timestamp Control can be changed to desired format of date and time. But for gviweb, it is not possible to do that.)

 

From:

https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatetimeinput/index.htm#demos/jqxdatetimeinpu...

 

and..

https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatetimeinput/jquery-datetim...

To set a property(option), you need to pass the property name and value(s) in the jqxDateTimeInput's constructor.

$("#jqxdatetimeinput").jqxDateTimeInput({ formatString: "dd/MM/yyyy" });

 

I got this to work with my basic CSS / javascript knowledge:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>

    <script type="text/javascript">

        $(document).ready(function()

        {

            $(".timestamp").attr("format-string", "dd/MM/yyyy HH:mm");

        });

</script>

 My code waits for the page to load, then updates the format-string attribute with my preferred format string. I do feel there should be a cleaner way. 

 

Nick

0 Kudos
Message 1 of 2
(1,613 Views)

I only need date picker option now. But I can't figure out how to hide the time selection in the footer?

0 Kudos
Message 2 of 2
(1,479 Views)