0

I'm trying to get date from timeuuid without calling dateOf(id) function in cqlsh. So, is there any function in phpcassa that can convert timeuuid to date ?

2

1 Answer 1

2

You can use the $time attribute of \phpcassa\UUID objects to get a unix timestamp, like so:

$timeuuid = UUID::uuid1();
echo "timestamp: $timeuuid->time";

From there it's easy to make other date and time objects.

2
  • Well, I try to convert an existing string timeuuid to uuid1. i.e $timeuuid = "0e6f9df0-fb40-11e2-8bbc-ef32f0e43a97". I'm trying to get timestamp out of it. How can I do that ?
    – aacanakin
    Aug 2, 2013 at 7:02
  • 1
    You need to create a UUID object from that string first by doing $timeuuid = UUID::import("0e6f9df0-fb40-11e2-8bbc-ef32f0e43a97"); Aug 2, 2013 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.