Last active
August 29, 2015 14:27
-
-
Save elringus/aa1d511d005570616f0f to your computer and use it in GitHub Desktop.
Collection of various blueprint functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Saga.h" | |
#include "BlueprintUtils.h" | |
FDateTime UBlueprintUtils::StringToDatetime(const FString& dateTimeString) | |
{ | |
FString modifiedString; | |
dateTimeString.Split(TEXT("."), &modifiedString, nullptr); | |
FDateTime dateTime; | |
FDateTime::ParseIso8601(*modifiedString, dateTime); | |
return dateTime; | |
} | |
FTimespan UBlueprintUtils::StringToTimeSpan(const FString& timeSpanString) | |
{ | |
FTimespan timeSpan; | |
FTimespan::Parse(*FString::Printf(TEXT("%s.000"), *timeSpanString), timeSpan); | |
return timeSpan; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "Kismet/BlueprintFunctionLibrary.h" | |
#include "BlueprintUtils.generated.h" | |
/** | |
* Collection of various blueprint functions. | |
*/ | |
UCLASS() | |
class SAGA_API UBlueprintUtils : public UBlueprintFunctionLibrary | |
{ | |
GENERATED_BODY() | |
public: | |
/** | |
* Converts an ISO-8601 formatted DateTime string to UE native DateTime struct. | |
* @param dateTimeString ISO-8601 compliant DateTime representation. | |
* @return UE native DateTime struct. | |
*/ | |
UFUNCTION(BlueprintPure, Category = "Utils|Time", meta = (DisplayName = "String To DateTime")) | |
static FDateTime StringToDatetime(const FString& dateTimeString); | |
/** | |
* Converts a .NET TimeSpan string to UE native TimeSpan struct. | |
* @param timeSpanString .NET string TimeSpan representation. | |
* @return UE native TimeSpan struct. | |
*/ | |
UFUNCTION(BlueprintPure, Category = "Utils|Time", meta = (DisplayName = "String To TimeSpan")) | |
static FTimespan StringToTimeSpan(const FString& timeSpanString); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment