COMMUNITY

How to convert float to Bytes?

I want to convert Date.now().getTime() to float bytes. are there any api?

package;


import hxbit.*;



class User implements hxbit.Serializable {
	@:s public var date: Float;
   
	public function new(){
		
	}
   
   
}


 
class Main 
{
	
	static function main() 
	{
		var s = new hxbit.Serializer();
		var u = new User();
		
		
		var now = Date.now().getTime();
		u.date = now;
		trace(now);
		
		
	
		var xx = s.serialize(u);
		
		
		
		var u = new hxbit.Serializer();
		
		var yy = u.unserialize(xx,User);
		
		
		trace(yy.date);
		
		trace(yy.date==now);//false
		
		
	}
	
}

and I try to use lib it’s not correct.

Look at haxe.io.Bytes, following FPHelper