Forum Discussion

abdul_rp's avatar
abdul_rp
Contributor
14 years ago

How to display the Time in 12Hour Format



Hi ,



Following code displays the current time in 24Hour Format ,But I want to the time in 12Hour Format.



Eg: Current System Time  is 9:00 PM but aqDateTime["Time"]()  diaplaying time as 21:00.

I want it to be displayed as 9:00 PM . I am trying to use following code but it is not working



var CurrentTime = aqDateTime["Time"]();

CurrentTimeDisplayIn = aqDateTime["Use12HourFormat"](CurrentTime);



Kindly provide me the solution



Regards,

Abdul

2 Replies

  • mijex71989's avatar
    mijex71989
    Occasional Contributor
    var CurrentTime = aqDateTime["Time"]();

    CurrentTimeDisplayIn = aqConvert["DateTimeToFormatStr"](CurrentTime, "%#I:%M");
  • Thanks for the reply



    Following code worked for me.


    CurrentTime=aqDateTime.Now();


    ConvertedTime=aqConvert["DateTimeToFormatStr"](CurrentTime,'%H:%M');


    ConvertedTime=Trim(ConvertedTime);