dualznz Member Licensed User Longtime User Jun 11, 2013 #1 Hi all this is for a widget that im building for my application the time is used to show when the next update will be performed. say now + 45 minutes i have tried the following to convert unix to standard datetime format but still shows unix output Code: Dim TicksDiff, HoursDiff, unixtimestamp As String unixtimestamp = DateTime.Now * DateTime.TicksPerMinute TicksDiff = DateTime.Now - unixtimestamp * 1000 HoursDiff = TicksDiff / DateTime.TicksPerHour i am trying to do something like this Code: dim newdate as string newdate = datetime.now + 45 * datetime.ticksperminute // display as standard formate or DD/MM/YY HH:MM or just HH:MM any help would be greateful
Hi all this is for a widget that im building for my application the time is used to show when the next update will be performed. say now + 45 minutes i have tried the following to convert unix to standard datetime format but still shows unix output Code: Dim TicksDiff, HoursDiff, unixtimestamp As String unixtimestamp = DateTime.Now * DateTime.TicksPerMinute TicksDiff = DateTime.Now - unixtimestamp * 1000 HoursDiff = TicksDiff / DateTime.TicksPerHour i am trying to do something like this Code: dim newdate as string newdate = datetime.now + 45 * datetime.ticksperminute // display as standard formate or DD/MM/YY HH:MM or just HH:MM any help would be greateful
dualznz Member Licensed User Longtime User Jun 11, 2013 #2 nevermind i found a simple solution to do this Code: DateTime.DateFormat = "hh:mm" Dim dt As String = DateTime.Date(DateTime.Now + 45 * DateTime.TicksPerMinute) label1.Text = dt Upvote 0
nevermind i found a simple solution to do this Code: DateTime.DateFormat = "hh:mm" Dim dt As String = DateTime.Date(DateTime.Now + 45 * DateTime.TicksPerMinute) label1.Text = dt
Erel B4X founder Staff member Licensed User Longtime User Jun 11, 2013 #3 Check DateUtils. It has methods to add a "period" to a given date and also to convert unix time to B4A time. Upvote 0
Check DateUtils. It has methods to add a "period" to a given date and also to convert unix time to B4A time.