Printing current date/time header

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Printing current date/time header

Serkan Taş
Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working
(not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>
Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Alex Harui-2

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>

Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Greg Dove

Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.




On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[hidden email]> wrote:

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>

Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Serkan Taş
Hi Greg and Alex,

The reason is related with string format in DateFormatter, setter is not implemented and format function is not implemented either.

The setter for formatString is commented. I can create PR for the change but it is not simple. It requires to initialization of resource manager "SharedResoources" and I guess it inherits from the class Formatter which is also commented.

The function :

    public function set formatString(value:String):void
    {
        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }


Simply can solve if change to :

    public function set formatString(value:String):void
    {


        _formatString = value;

        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }



But the format function needs more work.

Thanks,
Serkan

21.10.2019 01:59 tarihinde Greg Dove yazdı:

Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.




On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[hidden email]> wrote:

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>


Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Alex Harui-2

If all you need is a JS version, you might be able to just call toLocaleDateString() for now.

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 11:35 PM
To: "[hidden email]" <[hidden email]>
Subject: Re: Printing current date/time header

 

Hi Greg and Alex,

The reason is related with string format in DateFormatter, setter is not implemented and format function is not implemented either.

The setter for formatString is commented. I can create PR for the change but it is not simple. It requires to initialization of resource manager "SharedResoources" and I guess it inherits from the class Formatter which is also commented.

The function :

    public function set formatString(value:String):void
    {
        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }


Simply can solve if change to :

    public function set formatString(value:String):void
    {


        _formatString = value;

        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }



But the format function needs more work.

Thanks,
Serkan

21.10.2019 01:59 tarihinde Greg Dove yazdı:


Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.

 

 

 

 

On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[hidden email]> wrote:

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>



Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Serkan Taş
js is ok for me, I will check toLocaleDateString() for use.

Thanks,
Serkan




On Mon, Oct 21, 2019 at 10:53 AM +0300, "Alex Harui" <[hidden email]> wrote:

If all you need is a JS version, you might be able to just call toLocaleDateString() for now.

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 11:35 PM
To: "[hidden email]" <[hidden email]>
Subject: Re: Printing current date/time header

 

Hi Greg and Alex,

The reason is related with string format in DateFormatter, setter is not implemented and format function is not implemented either.

The setter for formatString is commented. I can create PR for the change but it is not simple. It requires to initialization of resource manager "SharedResoources" and I guess it inherits from the class Formatter which is also commented.

The function :

    public function set formatString(value:String):void
    {
        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }


Simply can solve if change to :

    public function set formatString(value:String):void
    {


        _formatString = value;

        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }



But the format function needs more work.

Thanks,
Serkan

21.10.2019 01:59 tarihinde Greg Dove yazdı:


Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.

 

 

 

 

On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[hidden email]> wrote:

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>



Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Serkan Taş
Hi Alex, is toLocaleDateString() js function ?

Are there any examples or usage of the function ?

Thanks,
Serkan

21.10.2019 11:14 tarihinde Serkan Taş yazdı:
js is ok for me, I will check toLocaleDateString() for use.

Thanks,
Serkan




On Mon, Oct 21, 2019 at 10:53 AM +0300, "Alex Harui" <[hidden email]> wrote:

If all you need is a JS version, you might be able to just call toLocaleDateString() for now.

 

-Alex

 

From: Serkan Taş [hidden email]
Reply-To: [hidden email] [hidden email]
Date: Sunday, October 20, 2019 at 11:35 PM
To: [hidden email] [hidden email]
Subject: Re: Printing current date/time header

 

Hi Greg and Alex,

The reason is related with string format in DateFormatter, setter is not implemented and format function is not implemented either.

The setter for formatString is commented. I can create PR for the change but it is not simple. It requires to initialization of resource manager "SharedResoources" and I guess it inherits from the class Formatter which is also commented.

The function :

    public function set formatString(value:String):void
    {
        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }


Simply can solve if change to :

    public function set formatString(value:String):void
    {


        _formatString = value;

        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }



But the format function needs more work.

Thanks,
Serkan

21.10.2019 01:59 tarihinde Greg Dove yazdı:


Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.

 

 

 

 

On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[hidden email]> wrote:

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>




Reply | Threaded
Open this post in threaded view
|

Re: Printing current date/time header

Serkan Taş
Hi Alex,

I fixed the issue using the below code piece :

COMPILE::JS
                    {
                        var dateTime = new Date();
                        time =
dateTime.toLocaleTimeString() + ' ' + dateTime.toLocaleDateString();
                       
                    }


Thanks
Serkan

21.10.2019 12:17 tarihinde Serkan Taş yazdı:
Hi Alex, is toLocaleDateString() js function ?

Are there any examples or usage of the function ?

Thanks,
Serkan

21.10.2019 11:14 tarihinde Serkan Taş yazdı:
js is ok for me, I will check toLocaleDateString() for use.

Thanks,
Serkan




On Mon, Oct 21, 2019 at 10:53 AM +0300, "Alex Harui" <[hidden email]> wrote:

If all you need is a JS version, you might be able to just call toLocaleDateString() for now.

 

-Alex

 

From: Serkan Taş [hidden email]
Reply-To: [hidden email] [hidden email]
Date: Sunday, October 20, 2019 at 11:35 PM
To: [hidden email] [hidden email]
Subject: Re: Printing current date/time header

 

Hi Greg and Alex,

The reason is related with string format in DateFormatter, setter is not implemented and format function is not implemented either.

The setter for formatString is commented. I can create PR for the change but it is not simple. It requires to initialization of resource manager "SharedResoources" and I guess it inherits from the class Formatter which is also commented.

The function :

    public function set formatString(value:String):void
    {
        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }


Simply can solve if change to :

    public function set formatString(value:String):void
    {


        _formatString = value;

        /* formatStringOverride = value;

        _formatString = value != null ?
                        value :
                        resourceManager.getString(
                            "SharedResources", "dateFormat"); */
    }



But the format function needs more work.

Thanks,
Serkan

21.10.2019 01:59 tarihinde Greg Dove yazdı:


Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.

 

 

 

 

On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[hidden email]> wrote:

I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

 

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "[hidden email]" <[hidden email]>
Subject: Printing current date/time header

 

Hi,

Is there an example of showing current date time on page, as my version converted from flex is not working.

Thanks
Serkan,

*****************************************
My code for royale (not complete source) :

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(Timer.TIMER, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:Timer):void {
                showTime();
            }


to show :

<s:Button id="button1" width="200" label="Time : {time}" click="button_clickHandler(event)"/>



*****************************************
Flex version which is working (not complete source):

            public function showTime():void {
                var currentTime:Date = new Date();
                var timeFormat:DateFormatter = new DateFormatter();
                timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
                time = timeFormat.format(currentTime);
                ticker = new Timer(1,1);
                ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
                ticker.start();
            }
           
            public function onCreationComplete():void {
                showTime();
            }
           
            public function onTimerComplete(event:TimerEvent):void {
                showTime();
            }



to show :

<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>