09-08-2010 11:17 PM
In my application, I have a predefined time and date format along with a time value in seconds. With these inputs, I need to display the actual time and date. How can i implement the idea? Please provide the logic.
Reference:
Date format: 1950/01/01
Time format: 00:00:00
Time value in seconds given by a 32bit register: 86461 (24*60*60 = 1day 1min 1sec)
If inputs are as shown, then the output to be displayed is 1950/01/02 00:01:01
09-08-2010 11:27 PM
Use a timestamp with your start date (january first 1950) and use a normal 'Add' function with the U32, the output will be timestamp at the correct moment.
Ton
09-08-2010 11:52 PM
Hi,
Thanks for the reply..
But there is a problem in your solution. How can we represent the correct date including 30-day month, 31-day month etc...???
09-09-2010 01:47 PM
Could you post your code?
To me it sounds like you didin't understande me, since the timestamp deals with the representation of the date.
Ton
09-12-2010 10:45 PM
Hi,
I dont have any code for this. I think i need to implement a calendar for this purpose. Please see the example:
Predefined Date : 2010/01/01
Predefined Time : 00:00:00
Register value : 5184000
Output timestamp value should be 2010/03/02 00:00:00
Regards,
Shiva
09-12-2010 11:17 PM
You should at least try the timestamp idea. It does everything you have explained
09-12-2010 11:50 PM
Hi,
Thanks for your reply.
When i change the time in the timestamp constant to 00:00:00, it automatically changes to 05:29:59. Why it is so? How can i fix the time to 00:00:00?
Regards,
Shiva
09-12-2010 11:55 PM
It doesn't in my example. Are you using that? If you are using your own, did you change the display format to custom? To 24 hr?
09-13-2010 12:02 AM
I am using your example only & not changed any settings. Right click and select Set time and date, and update the time to 00:00:00 and date to 1970/01/01. The time is changing...
09-13-2010 12:13 AM
It does not do it for me. I'm actually running 2010. Or perhaps it's due to a regional setting. Vac you change the year by just typing it in the control?