# How to convert float to Bytes?

**URL:** <https://community.haxe.org/t/how-to-convert-float-to-bytes/1963>\
**Category:** Haxe\
**Created:** [August 14, 2019, 9:40am UTC](https://community.haxe.org/t/how-to-convert-float-to-bytes/1963 "2019-08-14T09:40:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)\
**Post date:** [August 14, 2019, 9:40am UTC](https://community.haxe.org/t/how-to-convert-float-to-bytes/1963/1 "2019-08-14T09:40:48Z")

</div>

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

```haxe
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.

---

<div class="post-metadata">

**Author:** ![Ilir-Liburn](https://avatars.discourse-cdn.com/v2/letter/i/82dd89/32.png) [@Ilir-Liburn](https://community.haxe.org/u/Ilir-Liburn)\
**Post date:** [August 14, 2019, 2:28pm UTC](https://community.haxe.org/t/how-to-convert-float-to-bytes/1963/2 "2019-08-14T14:28:21Z")

</div>

Look at haxe.io.Bytes, following FPHelper
